java - Selenium Webdriver - Able to locate elements through firebug, but getting nosuchelementexception at Webdriver -
what happens have webpage: following div
what's visible in cyan in screenshot above. i've circled bit of text i'm trying find:
i've tried xpath , css. both work in firebug , both locate elements fine inside floating div. when run script, nosuchelement exception.
-things i'm suspicious of:
- as can see, div call webpage (indicated whole html tree inside div). might reason webdriver goes hell , doesn't find anything. have no idea how tell in window.
- the div acts floating pop-up, graying out rest of background page. not sure if has do, might causing trouble too.
i don't think it's necessary, here 1 of css locators i'm using in firepath , works in locating 5040 text.
driver.findelement(by.cssselector(".feature>tbody>tr>td[width='312']")
so question here is: how locate text in these td
's if xpath/css locators work manually not webdriver?
see iframe
element - reason getting exception.
you need switch iframe
before finding element:
driver.switchto().frame("content")
or (in case not working due spaces in id
):
driver.switchto().frame(driver.findelement(by.cssselector("iframe[id$=content]"));
Comments
Post a Comment