How to find the XPath for the below provided screenshot page



  • I want to click on the 4th element of the list it's an auto populate list and following code is not working.

    driver.findElement(By.xpath("//*[@data-text-as-pseudo-element='CORENA P 150']")).sendKeys(Keys.DOWN);

    enter image description here



  • You've got the * in the wrong place (end of line), haven't you? Add it after the // or use a div instead.

    driver.findElement(By.xpath("//div[@data-text-as-pseudo-element='CORENA P 150']")).sendKeys(Keys.DOWN);
    

    Edit - Also looks like you could probably just use .click(); rather than .sendKeys(Keys.DOWN)?


Log in to reply
 

Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2