Search
 
 

Display results as :
 


Rechercher Advanced Search

Latest topics
» Regarding Alert Interface
Fri Feb 24, 2017 2:00 pm by karthikeyakumar

» 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

Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

How do I get checkbox element identifier generated dynamically?

View previous topic View next topic Go down

How do I get checkbox element identifier generated dynamically?

Post by gkpandi on Wed Jun 26, 2013 2:40 pm

Hi,
Could you please tell me how do I recognize a checkbox which is present inside a div tag. And the checkbox ID is changing dynamically everytime when we hit the page and the element also does not have a name attribute.

In the "firepath" plug-in, it is displaying like ".//*[@id='ext-gen780']" but it is not reliable.

I have tried with XPath command with contains() function as below

Command : ClickAt
Target : xpath=.//*[contains(text(),'Custom2')]


It is finding the correct element [ when no text is present in the page, contains "Custom" ]. If it is there means, the actual checkbox is not checked.

I'm struggling with this issue for TWO days. Please help me to solve this.

Here's the HTML content for a checkbox gathered by using Firebug Addon.

Please find the screenshot for your reference.



Thanks in advance

gkpandi
Active particpant
Active particpant

Posts : 14
Join date : 2013-05-23

Back to top Go down

Re: How do I get checkbox element identifier generated dynamically?

Post by mail2prassad on Wed Jun 26, 2013 9:05 pm

Even the ID is dynamically generated, there should be a pattern. Identify the pattern and try the code below.

WebElement checkboxElement = .findelement(By.xpath("//*[@type='checkbox' and contains(@id, 'COMMON_PATTERN')]")

mail2prassad
Amateur
Amateur

Posts : 41
Join date : 2013-06-05

Back to top Go down

Re: How do I get checkbox element identifier generated dynamically?

Post by gkpandi on Thu Jun 27, 2013 5:32 pm

Yeh! Agree with you.

I'm getting element ID thru' FirePath plugin like this.

.//*[@id='ext-gen780']

the common pattern is for all the element is, "ext-gen" (with some numbers). As per your reply, how can I determine this is what the particular element?

Note:
Please share your answer for Selenium IDE, not for WebDriver.

gkpandi
Active particpant
Active particpant

Posts : 14
Join date : 2013-05-23

Back to top Go down

Re: How do I get checkbox element identifier generated dynamically?

Post by mail2prassad on Thu Jun 27, 2013 9:25 pm

Either by value attribute of the checkbox or the element text.

mail2prassad
Amateur
Amateur

Posts : 41
Join date : 2013-06-05

Back to top Go down

Re: How do I get checkbox element identifier generated dynamically?

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