Search
 
 

Display results as :
 


Rechercher Advanced Search

Latest topics
» Geting issues in identifying the elsements in webdriver
Fri Feb 17, 2017 4:41 pm by janbaskt

» WebDriver - why not to use a singlton for it?
Fri Feb 17, 2017 4:40 pm by janbaskt

» WebDriver session when using testng annotation to invoke driver instance
Fri Feb 17, 2017 4:39 pm by janbaskt

» Selenium fails to launch Chrome
Fri Feb 17, 2017 4:39 pm by janbaskt

» why do i get this error
Fri Feb 17, 2017 4:38 pm by janbaskt

» Selenium Tutorial
Thu Feb 16, 2017 5:21 pm by Rahul

» When to use Selenium IDE, RC and WebDriver
Mon Feb 13, 2017 2:35 pm by azharuddin

» How to integrate selenium with ZAPI-Zephyr
Sat Feb 11, 2017 2:25 am by gseera002c

» Selenium Webdriver
Sat Feb 04, 2017 6:47 pm by soumyamishrav@gmail.com

Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

How Click on Dynamic Objects at Dynamic Positions in Selenium using for loop

View previous topic View next topic Go down

How Click on Dynamic Objects at Dynamic Positions in Selenium using for loop

Post by Pallavi Choudhary on Thu Jul 19, 2012 1:20 pm

I have one table having four columns and dynamic rows.
i want to click to the 4th cell of table which is link to the other page.
Please help me.

Thanks in advance.
Pallavi

Pallavi Choudhary
Active particpant
Active particpant

Posts : 24
Join date : 2012-05-08

Back to top Go down

Re: How Click on Dynamic Objects at Dynamic Positions in Selenium using for loop

Post by jayanth on Thu Jul 19, 2012 4:59 pm

You can use regular expression to access dynamic links in the table

jayanth

Posts : 2
Join date : 2012-07-19

Back to top Go down

Re: How Click on Dynamic Objects at Dynamic Positions in Selenium using for loop

Post by Pallavi Choudhary on Thu Jul 19, 2012 5:09 pm

Thanks for Rply.

Can you please give me the syntax.

I use this syntax but it is not working :

for (int i = 0; i < rowCount_tpsumry; i++)
{
selenium.click("xpath=(//a[@name='a1'])[position()=i]");
}

Thanks in advance.
Pallavi


Pallavi Choudhary
Active particpant
Active particpant

Posts : 24
Join date : 2012-05-08

Back to top Go down

Re: How Click on Dynamic Objects at Dynamic Positions in Selenium using for loop

Post by jayanth on Thu Jul 19, 2012 5:22 pm

The following is the sample Regex code,

String htmlSource = selenium.getHtmlSource();

String patternformat = appName + "\\s+(.+?) id=\"(.+?)\"";
Pattern pattern = Pattern.compile(patternformat, Pattern.DOTALL | Pattern.MULTILINE);

Matcher matcher = pattern.matcher(htmlSource);
if (matcher.find())
value = matcher.group(2);
String edit = "id=" + value;

Here you can get the value of the particular link

Use www*regexplanet*com/advanced/java/index*html to find your group id by matching the string values

jayanth

Posts : 2
Join date : 2012-07-19

Back to top Go down

Re: How Click on Dynamic Objects at Dynamic Positions in Selenium using for loop

Post by Pallavi Choudhary on Thu Jul 19, 2012 8:28 pm

Actually i am getting the value of the link which i want.
My problem is that i am not able to sun the script for all the values.
The following code will click on the link present on the first position.
selenium.click("xpath=(//a[@name='a1'])[position()=1]");
But i want to make it generalize.





Pallavi Choudhary
Active particpant
Active particpant

Posts : 24
Join date : 2012-05-08

Back to top Go down

Re: How Click on Dynamic Objects at Dynamic Positions in Selenium using for loop

Post by srilathap on Sat Nov 10, 2012 9:24 pm

Hi,

HOW TO PASS MULTIPLE DATA THROUGH XLS SHEET with out using framwork.


I WANT EXECUTE MULTIPLE DATA.

pLEASE CAN U UPDATE

srilathap
Active particpant
Active particpant

Posts : 18
Join date : 2011-10-11

Back to top Go down

Re: How Click on Dynamic Objects at Dynamic Positions in Selenium using for loop

Post by Sponsored content


Sponsored content


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