MrBridger MrBridger - 1 year ago 135
Java Question

Selenium WebDriver Java cssSelector Span

I am trying to click on a link using Selenium WebDriver in Java. My Java:


The HTML on my page looks like this:

<span data-seleniumid="Address0" class="ATAddressLine">1 The Road, Town, City, Postcode</span>

The error in Eclipse is:

org.openqa.selenium.NoSuchElementException: Unable to locate element: {"method":"css selector","selector":"span[data-seleniumid=\"Address0\"]"}


Answer Source

Thanks for you help all. The element wasn't being found because it was in an iframe popup and Selenium was searching for it in the page behind.

This post: helped.

For anyone in the future my code is now:

WebElement iFrame= driver.findElement(By.tagName("iframe"));

        // Select an address

        // Switch back to the default page

Thanks again.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download