- gkpandiActive particpant
- Posts : 14
Join date : 2013-05-23
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.
Thanks in advance
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
- mail2prassadAmateur
- Posts : 41
Join date : 2013-06-05
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')]")
WebElement checkboxElement =
- gkpandiActive particpant
- Posts : 14
Join date : 2013-05-23
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.
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.
- mail2prassadAmateur
- Posts : 41
Join date : 2013-06-05
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.
Permissions in this forum:
You cannot reply to topics in this forum