Selenium Forum: Functional And Regression Testing Tool.
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Search
Display results as :
Advanced Search
Latest topics
AEM Training | Free Online DemoWed Apr 21, 2021 5:45 pmazharuddin
c# PageFactory - issue initializing elementsFri Nov 01, 2019 8:40 pmthegoatboy
Selenium making automatic connection to random urlsMon Jul 08, 2019 12:58 pmrepairtechsolutions1
How can we design the custom framework in Selenium RCMon Jun 24, 2019 2:26 pmrandybonnettes
What are the new features in Selenium 3.0Tue Jun 18, 2019 5:37 pmpappyvicky
What are you using Selenium for? Fri Apr 12, 2019 3:52 amzhl
LIMITATIONS OF SELENIUMWed Apr 10, 2019 11:23 amswara
Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

Go down
avatar
Vinay4selinium
Posts : 2
Join date : 2012-09-27

drop downs Empty drop downs

Tue Nov 20, 2012 7:38 pm
I have a website which i am trying to automate i am able to login and click one of the menu, but i am facing problem when i have click third child

say i have a mainmenu which displalys submenu , onclick of the submenu it displaly third menu which has 10 links displayed in top-down order i have click on 9th child which i am unable to do.

here is code


WebElement myElement1 = driver.findElement(By.xpath("/html/body/form/div[5]/div/div[2]/table/tbody/tr/td[2]/div/div/ul/li/ul/li[2]/span/span/span"));
Actions builder = new Actions(driver);
builder.moveToElement(myElement1).build().perform();
myElement1.click();

WebElement myElement2 = driver.findElement(By.xpath("/html/body/form/div[5]/div/div[2]/table/tbody/tr/td[2]/div/div/ul/li/ul/li[2]/ul/li/span/span/span"));
Actions builder1 = new Actions(driver);
builder1.moveToElement(myElement2).build().perform();
myElement2.click();
http://driver.findElement(By.xpath("/html/body/form/div[5]/div/div[2]/table/tbody/tr/td[2]/div/div/ul/li/ul/li[2]/span/span/span")).click();
http://driver.findElement(By.xpath("/html/body/form/div[5]/div/div[2]/table/tbody/tr/td[2]/div/div/ul/li/ul/li[2]/ul/li/span/span/span")).click();

WebDriverWait wait = new WebDriverWait(driver, 40);
WebElement ele=driver.findElement(By.xpath("/html/body/form/div[5]/div/div[2]/table/tbody/tr/td[2]/div/div/ul/li/ul/li[2]/ul/li/ul/li[9]/a/span/span"));
System.out.println(ele.getText());


WebElement element = wait.until(
ExpectedConditions.visibilityOfElementLocated(By.xpath("/html/body/form/div[5]/div/div[2]/table/tbody/tr/td[2]/div/div/ul/li/ul/li[2]/ul/li/ul/li[9]/a/span/span")));
System.out.println(" about to get enter time sheet" +element.getText());
System.out.println(isElementPresent(By.xpath("/html/body/form/div[5]/div/div[2]/table/tbody/tr/td[2]/div/div/ul/li/ul/li[2]/ul/li/ul/li[9]/a/span/span")));
driver.manage().timeouts().implicitlyWait(2500, TimeUnit.SECONDS);
http://org.openqa.selenium.Point coordinates = driver.findElement(By.xpath("/html/body/form/div[5]/div/div[2]/table/tbody/tr/td[2]/div/div/ul/li/ul/li[2]/ul/li/ul/li[9]/a/span/span")).getLocation();
//Robot robot = new Robot();
// robot.mouseMove(coordinates.getX(),coordinates.getY()+120);

org.openqa.selenium.Point coordinates = driver.findElement(By.xpath("/html/body/form/div[5]/div/div[2]/table/tbody/tr/td[2]/div/div/ul/li/ul/li[2]/ul/li/ul/li[9]/a/span/span")).getLocation();
System.out.println(coordinates.getX()+ " "+ coordinates.getY());
WebElement myElement3 = driver.findElement(By.xpath("/html/body/form/div[5]/div/div[2]/table/tbody/tr/td[2]/div/div/ul/li/ul/li[2]/ul/li/ul/li[9]/a/span/span"));
Actions builder3 = new Actions(driver);
builder3.moveToElement(myElement3).build().perform();
myElement3.click();


THe last drop down is the place where it fails


part of html code
Code:

<li class="static dynamic-children" _events="[object Object]" hoverDebouncer="0">
<SPAN class=additional-background><SPAN >Request /Approvals</SPAN></SPAN></SPAN>
<UL class=dynamic>
<LI class="dynamic dynamic-children" hoverDebouncer="0"><SPAN ><SPAN class=additional-background><SPAN class=menu-item-text>Request </SPAN></SPAN></SPAN>
<UL >
<LI ><A  href="/BusinessCard"><SPAN class=additional-background><SPAN class=menu-item-text>DUmmy</SPAN></SPAN></A></LI>
<LI ><A  href="/LeaveRequest"><SPAN class=additional-background><SPAN class=menu-item-text>Apply Leave</SPAN></SPAN></A></LI>
<LI ><A  href="/LoanRequest"><SPAN class=additional-background><SPAN class=menu-item-text>Apply </SPAN></SPAN></A></LI>
<LI ><A  href="https://webapps.com/NIO"><SPAN class=additional-background><SPAN class=menu-item-text>Apply </SPAN></SPAN></A></LI>
<LI ><A  href="https:///Pages/RelocationCorner.aspx"><SPAN class=additional-background><SPAN class=menu-item-text>Apply </SPAN></SPAN></A></LI>
<LI ><A  href="/VisaRT"><SPAN class=additional-background><SPAN class=menu-item-text> Visa</SPAN></SPAN></A></LI>
<LI ><A  href="/FEPClaim"><SPAN class=additional-background><SPAN class=menu-item-text>Claim </SPAN></SPAN></A></LI>
<LI ><A  href="/DeclareFEP"><SPAN class=additional-background><SPAN class=menu-item-text>Declare </SPAN></SPAN></A></LI>
<LI ><A  href="/TimeSheet#"><SPAN class=additional-background><SPAN class=menu-item-text> Time Sheets</SPAN></SPAN></A></LI>
Back to top
Permissions in this forum:
You cannot reply to topics in this forum