zoukankan      html  css  js  c++  java
  • selenium 修改元素属性值

    给元素加高亮显示

    self.driver.execute_script(
    "arguments[0].setAttribute('style', arguments[1]);",
    element,
    "border: 2px solid red;" #边框border:2px; red红色
    )

     code2

    #给id为nice的元素 增加 title属性并赋值为“测试title”
    js='document.getElementById("nice").setAttribute("title","测试title")'
    #给id为nice的元素 删除 title属性
    js='document.getElementById("nice").removeAttribute("title")'
    #获取id为nice的元素 title属性的值
    js='document.getElementById("nice").getAttribute("title")'
    #修改id为nice的元素 title属性的值
    js='document.getELementById("nice").title="测试"'

  • 相关阅读:
    作业11图
    作业11
    作业10
    总结一
    物联网相关知识
    第十二次作业
    附加题4
    第十一次作业
    附加题3
    第十次作业
  • 原文地址:https://www.cnblogs.com/sea-stream/p/14271679.html
Copyright © 2011-2022 走看看