1

I'm having trouble inspecting elements inside a DIV; I don't want to use xpath.

     // Assert.assertEquals("Digite uma senha",driver.findElement(By.xpath("//*[@id=\"view_container\"]/div/div/div[2]/div/div[1]/div/form/span/section/div/div/div[1]/div[2]/div[2]/span")).getText()); 
     // System.out.println(driver.findElement(By.xpath("//*[@id=\"view_container\"]/div/div/div[2]/div/div[1]/div/form/span/section/div/div/div[1]/div[2]/div[2]/span")).getText()); 
             //  driver.close();

}enter image description here

Marit
  • 2,399
  • 18
  • 27
Tadeu
  • 67
  • 6

1 Answers1

1

You can use the below css.

div[jsname='B34EJ'] span
supputuri
  • 13,644
  • 2
  • 21
  • 39
  • If you feel the issue is resolved, please accept the answer by clicking on the check mark on the left hand side in my answer. – supputuri Apr 25 '20 at 17:59
  • Please, Do you have a query source where there are several examples for using DIV? Thank u – Tadeu Apr 25 '20 at 18:12
  • you can check CSS Selector reference [here](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors) – supputuri Apr 25 '20 at 22:18