I ran into a similar problem described here: Selenium - can't find visible element until HTML is inspected? But the solution indicated there did not help me.
There's a website that has the following dropbox (I can see them when I inspect the page):
No error is raised when I attempt to switch to the desired frame, no elements are found with id = UIFormControl-5
.
So after inspecting the dropbox (id = UIFormControl-5
) and doing no other change whatsoever, the elements are there, as if the mere act of looking at the source code of the webpage changed the outcome of the result. What could possibly be happening here?
I'm using the java selenium code
driver.switchTo().frame(driver.findElement(By.cssSelector("iframe.flex-grow-1")));
wait.until(ExpectedConditions.presenceOfElementLocated(By.id("UIFormControl-5")));
driver.findElement(By.id("UIFormControl-5")).click();