Is there a way to get element by XPath using JavaScript in Selenium WebDriver?

后端 未结 10 1607
后悔当初
后悔当初 2020-11-22 10:53

I am looking for something like:

getElementByXpath(//html[1]/body[1]/div[1]).innerHTML

I need to get the innerHTML of elements using JS (to

10条回答
  •  佛祖请我去吃肉
    2020-11-22 11:43

    Assuming your objective is to develop and test your xpath queries for screen maps. Then either use Chrome's developer tools. This allows you to run the xpath query to show the matches. Or in Firefox >9 you can do the same thing with the Web Developer Tools console. In earlier version use x-path-finder or Firebug.

提交回复
热议问题