My Java Selenium code needs to locate a visible element on the Google login API page. The HTML code is extracted from this page.
Below is the code snippet:
if(BaseSteps.elementExists(By.xpath("//*[@role=\"button\"]"), 30))
{
System.out.println($(By.xpath("//*[@role=\"button\"]")));
$(By.xpath("//*[@role=\"button\"]")).shouldBe(visible, ofSeconds(120)).click();
}
https://i.sstatic.net/yYuK7.png
The button in question has a display property set to inline-block as shown in the developer tools. The println() call outputs:
<div aria-disabled="false" class="U26fgb O0WRkf oG5Srb C0oVfc kHssdc M9Bg4d" data-custom-id="iPWQ6" data-id="ssJRIf" jsaction="click:cOuCgd; mousedown:UX7yZ; mouseup:lbsD7e; mouseenter:tfO1Yc; mouseleave:JywGue; focus:AHmuwe; blur:O22p3e; contextmenu:mg9Pef;touchstart:p6p2H; touchmove:FwuNnf; touchend:yfqBxc(preventMouseEvents=true|preventDefault=true); touchcancel:JMtRjd;" jscontroller="VXdfxd" jsname="LgbsSe" jsshadow role="button" tabindex="0" displayed:false></div>
At the end of the output, it states "displayed:false". I am unsure of its significance. Can someone help me identify the issue?