Search
 
 

Display results as :
 


Rechercher Advanced Search

Latest topics
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 Today at 4:49 am


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