Search
 
 

Display results as :
 


Rechercher Advanced Search

Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

drop downs

View previous topic View next topic Go down

drop downs

Post by Vinay4selinium on 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>

Vinay4selinium

Posts : 2
Join date : 2012-09-27

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum