Java 使用selenium获取CSS属性值
如何使用selnium RC获取CSS类的属性值 我使用webdriver尝试了它,但无法获得所需的内容您可以使用命令评估javascript以获取属性 从这个意义上讲,硒是非常有限的 编辑: this.style.someAttribute将为您提供给定Selenium节点的someAttribute css样式的值 此外,如果要在文档体中的元素(如document.getElementById..)上运行JavaScript,则需要使用此.browserbot.getCurrentWindow来处理JavaScript字符串。例如,如果我想获取id为“page_title”的元素的innerHTML,我会调用Java 使用selenium获取CSS属性值,java,selenium-rc,Java,Selenium Rc,如何使用selnium RC获取CSS类的属性值 我使用webdriver尝试了它,但无法获得所需的内容您可以使用命令评估javascript以获取属性 从这个意义上讲,硒是非常有限的 编辑: this.style.someAttribute将为您提供给定Selenium节点的someAttribute css样式的值 此外,如果要在文档体中的元素(如document.getElementById..)上运行JavaScript,则需要使用此.browserbot.getCurrentWindo
String title = getEval("this.browserbot.getCurrentWindow().document.getElementById('page_title').innerHTML");
这将在测试窗口的上下文中评估JavaScript。如果不包含此内容,将在Selenium框架的上下文中执行JavaScript。请参阅。如何使用java脚本获取CSS