Question

There is No Such Element Found even after switching to frame.

driver.switchTo().frame(frame);  
Select numberOfLinesMax = new Select(driver.findElement(By.name(name)));
numberOfLinesMax.selectByVisibleText("sometext");

The hierarchy of the element:

enter image description here

Was it helpful?

Solution

In this case, you're either going to have to use count (starting from 0), or a findElement

I think you can probably use

driver.switchTo().frame(1);

Or, and I think this may be the better solution

driver.switchTo().frame(findElement(By.css("form>iframe")));

especially if the form has a name or id.

i.e.

If you are going to css select based on form name X, then the css selector will look like this, where X is the name of the form. You can directly substitute the name for the form where the X is.

"form.X>iframe"

by form ID would look like this:

"form#formID>iframe"

where formID is the ID of the form.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top