Search
 
 

Display results as :
 


Rechercher Advanced Search

Latest topics
» how to connect DB in selenium webriver
Fri Oct 06, 2017 4:09 pm by anbarasi

» How find any text in browser screen and click on it?
Thu Oct 05, 2017 2:02 pm by sandeepkommineni

» Selenium Webdriver
Tue Oct 03, 2017 1:35 pm by PiyushBiswas

» GRID setup tutorial.
Wed Sep 27, 2017 4:29 pm by johnyapp

» Drag & Drop Between Windows Using Selenium Driver
Wed Sep 27, 2017 2:10 pm by 26rondel

» Check if window is closed / verify input
Sat Sep 23, 2017 10:21 pm by brainstir

» How to work on pages with AJAX in selenium?
Mon Sep 18, 2017 6:08 pm by azharuddin

» pause test until user press a key like F2
Wed Aug 09, 2017 11:10 pm by djnforce

» Selecting the input for auto populating element
Sat Jul 29, 2017 7:53 pm by kdabbara

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