Selenium Forum: Functional And Regression Testing Tool.
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Search
Display results as :
Advanced Search
Latest topics
AEM Training | Free Online DemoWed Apr 21, 2021 5:45 pmazharuddin
c# PageFactory - issue initializing elementsFri Nov 01, 2019 8:40 pmthegoatboy
Selenium making automatic connection to random urlsMon Jul 08, 2019 12:58 pmrepairtechsolutions1
How can we design the custom framework in Selenium RCMon Jun 24, 2019 2:26 pmrandybonnettes
What are the new features in Selenium 3.0Tue Jun 18, 2019 5:37 pmpappyvicky
What are you using Selenium for? Fri Apr 12, 2019 3:52 amzhl
LIMITATIONS OF SELENIUMWed Apr 10, 2019 11:23 amswara
Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

Go down
avatar
gkpandi
Active particpant
Active particpant
Posts : 14
Join date : 2013-05-23

How do I get checkbox element identifier generated dynamically? Empty How do I get checkbox element identifier generated dynamically?

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.

How do I get checkbox element identifier generated dynamically? Testim14

Thanks in advance
avatar
mail2prassad
Amateur
Amateur
Posts : 41
Join date : 2013-06-05

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

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')]")
avatar
gkpandi
Active particpant
Active particpant
Posts : 14
Join date : 2013-05-23

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

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.
avatar
mail2prassad
Amateur
Amateur
Posts : 41
Join date : 2013-06-05

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

Thu Jun 27, 2013 9:25 pm
Either by value attribute of the checkbox or the element text.
Sponsored content

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

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