Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. QA Testing
  3. Question
QA Testing

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

Asked by Bella Blake Jul 9, 2021 1.2K views 1 answer
Share

About this question

 I am looking for something like:

getElementByXpath(//html[1]/body[1]/div[1])[removed]

I need to get the innerHTML of elements using JS (to use that in Selenium WebDriver/Java, since WebDriver can't find it itself), but how?I could use ID attribute, but not all elements have ID attribute.

Your answer

1 Answer

More QA Testing discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest QA Testing Blogs

Guides, tips and career advice on QA Testing from JanBask experts.