Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/337.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 使用selenium获取CSS属性值_Java_Selenium Rc - Fatal编程技术网

Java 使用selenium获取CSS属性值

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

如何使用selnium RC获取CSS类的属性值

我使用webdriver尝试了它,但无法获得所需的内容

您可以使用命令评估javascript以获取属性

从这个意义上讲,硒是非常有限的

编辑:

this.style.someAttribute将为您提供给定Selenium节点的someAttribute css样式的值

此外,如果要在文档体中的元素(如document.getElementById..)上运行JavaScript,则需要使用此.browserbot.getCurrentWindow来处理JavaScript字符串。例如,如果我想获取id为“page_title”的元素的innerHTML,我会调用

String title = getEval("this.browserbot.getCurrentWindow().document.getElementById('page_title').innerHTML");

这将在测试窗口的上下文中评估JavaScript。如果不包含此内容,将在Selenium框架的上下文中执行JavaScript。请参阅。

如何使用java脚本获取CSS