I have a problem that is very strange for me because the code that I wrote, I am quite sure should work!
Config Details
Chrome version: 80.0.3987.132
ChromeDrivers version: same as Chrome version 80 (80.0.3987.106)
OS: Windows 10
IDE: InteliJ
Programming language:
Java API
TestURL: https://allegro.pl
I am currently testing , just for learning purpose, and so far everything worked. In general the basic approach to click a menu element is to use this code:
driver.findElement(By.xpath("//div[@data-box-name='Some Value']/div/ul/li[2]/a")).click();
Now I am in deeper menu category on this page: https://allegro.pl/kategoria/komputery and I want to click on "Drukarki i skanery" like this:
driver.findElement(By.xpath("//div[@data-box-name='Categories']/div/section/div[2]/ul/li[3]/a"))
I know this is good, because when I do right click on this element and select copy Xpath it gives me almost this same Xpath. It gives me this:
//*[@id="opbox-category-tree"]/section/div[2]/ul/li[3]/a
I have tried with this Xpath as well and it does not work as well. I attached screen so you may see how the code looks like.
Is it possible that this entry is too deep and I have to give some longer path to my element? Please any help would be appreciated, I am kind of stuck on that right now.
//a[contains(text(),'Drukarki i skanery') and @class='_w7z6o _uj8z7 _1h7wt _1bo4a _6kfrx']