Opening a href link in Selenium Java -
i trying click on following href link in selenium. have tried using xpath , by.linktext()
, by.cssselectort()
have not able locate element. appreciated
driver.findelement(by.linktext("ccc_ph3_sandbox_keybridge: ccc ph3 sandbox keybridge")).click();
and by.xpath()
unable locate element
webelement course = driver.findelementbyxpath("html/body/table/tbody/tr/td/div/div[2]/table/tbody/tr/td[3]/a/span[1]"); course.click();
css locator :
driver.findelement(by.cssselector("a[href*='/webapps/portal']")).click();
here html snippet:
<img width="12" height="12" src="/images/ci/icons/bookopen_li.gif" alt=""> <a target="_top" href=" /webapps/portal/frameset.jsp?tab_tab_group_id=_2_1&url=%2fwebapps%2fblackboard%2fexecute%2flauncher%3ftype%3dcourse%26id%3d_2135_1%26url%3d">ccc_ph3_sandbox_keybridge: ccc ph3 sandbox keybridge</a>
try using by.partiallinktext()
below :-
new webdriverwait(driver, 10).until(expectedconditions.elementtobeclickable(by.partiallinktext("ccc_ph3_sandbox_keybridge"))).click();
edited:- have mentioned element inside 2 iframes id navframe
, contentframe
, need switch iframes 1 one before finding element :-
driver.switchto().frame("navframe"); driver.switchto().frame("contentframe"); //now find desire element new webdriverwait(driver, 10).until(expectedconditions.elementtobeclickable(by.partiallinktext("ccc_ph3_sandbox_keybridge"))).click(); //after doing stuff inside iframe switch default content driver.switchto().defaultcontent();
Comments
Post a Comment