jquery - movehover from Selenium on a dropdown -
below code in html
<div id="pmenu_root_10" class="itemborder" style="position: absolute; left: 809px; top: 0px; width: 58px; height: 98px; z-index: 1000; background: rgb(190, 213, 231) none repeat scroll 0% 0%; cursor: default;" onmouseover="pmenu.over('root',10)" onmouseout="pmenu.out('root',10)" onclick="pmenu.click('root',10)"> <div class="lowtext" style="font-size: 11px; font-family: arial; color: #0066cc; position: absolute; left: 1px; top: 1px; width: 56px; height: 96px">reports</div> </div>
i trying hover mouse selenium can select 1 of sub menu present. selenium not able element
webelement ele = driver.findelement(by.xpath(".//div[@id='pmenu_root_10']/div[text()='reports']")); actions act = new actions(driver); act.movetoelement(ele).perform();
i tried using abosulte xpath given firepath
.//*@id='loginformname']/table[2]/tbody/tr/td[2]/table[1]/tbody/tr[5]/td/div/table/tbody/tr/td[3]/img
please me in finding issue
below error returned
exception in thread "main" org.openqa.selenium.nosuchelementexception: no such element: unable locate element: {"method":"xpath","selector":".//div[@id='pmenu_root_10']/div[text()='reports']"}
after enter username , password site, use below mentioned code access sub menu.
driver.findelement(by.id("login_button")).click(); webdriverwait after_login = new webdriverwait(driver, 10); after_login.until(expectedconditions.elementtobeclickable(driver.findelement(by.xpath("//div[@id='parent_25']/a[contains(text(), 'projects, delivery & sales')]")))); webelement menu_element = driver.findelement(by.xpath("//div[@id='parent_25']/a[contains(text(), 'projects, delivery & sales')]")); menu_element.click(); webdriverwait wait = new webdriverwait(driver, 10); wait.until(expectedconditions.elementtobeclickable(driver.findelement(by.xpath("//div[@id='parentgroup_25']/..//div[@class='hreftheme_applinks_sub_links_li_megamenu']/a[contains(text(), 'integrated project management system')]")))); webelement sub_menu_element = driver.findelement(by.xpath("//div[@id='parentgroup_25']/..//div[@class='hreftheme_applinks_sub_links_li_megamenu']/a[contains(text(), 'integrated project management system')]")); sub_menu_element.click(); webdriverwait ipms_sub_menu_launch_button = new webdriverwait(driver, 10); wait.until(expectedconditions.elementtobeclickable(driver.findelement(by.xpath("//div[@id='content']/..//following::td/img[@alt='launch ipms']")))); driver.findelement(by.xpath("//div[@id='content']/..//following::td/img[@alt='launch ipms']")).click(); thread.sleep(8000); string childwindow = (string) driver.getwindowhandles().toarray()[1]; driver.switchto().window(childwindow); // switch newly opened window. system.out.println("switch new tab."); driver.findelement(by.xpath("//form[@id='loginformname']/..//following::td/img[@src='images/go_on.gif']")).click(); // after new tab, webelement accessible. thread.sleep(8000); try { string report_page_url = driver.getcurrenturl(); system.out.println(report_page_url); string url = "https://ipmsapp.ultimatix.net/webipms/calhome_new.jsp"; if(report_page_url.equals(url)) { system.out.println("i on report page."); } } catch(exception e) { system.out.println("report page not open."); }
Comments
Post a Comment