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
imfaus
Active particpant
Active particpant
Posts : 13
Join date : 2012-01-13

dynamically finding checkbox in multi-select drop down Empty dynamically finding checkbox in multi-select drop down

Tue Feb 21, 2012 5:21 am
I am trying to click on a checkbox (that is a drop down in a multi-select). The problem is that the checkbox has no unique (valid) javascript ID.


Below is what I am trying in selenium and its failing. Any ideas? The product is using dotnetnuke which appears to have some unusual challenges with coding any type of gui automation. Thanks


Actual Element:

css=#dnn_ctr432_ViewMerchantWizard_MerchantWizard1_cbWizardPanel_ContactTab_ControlUC_ContactGrid_DXPEForm_efnew_EditContact1_ContactTypeCtrl_MultiSelectASPxDropDownEdit_DDD_DDTC_MultiSelectASPxListBox_LBI4T0 > input[type="checkbox"]


IDE command

xpath=//input[@type='checkbox'][contains(@id, 'ViewMerchantWizard_MerchantWizard1_cbWizardPanel_ContactTab_ControlUC_ContactGrid_DXPEForm_efnew_EditContact1_ContactTypeCtrl_MultiSelectASPxDropDownEdit_DDD_DDTC_MultiSelectASPxListBox_LBI4T0')]


HTML (IDE code)


mouseDown
xpath=//img[contains(@id, 'ViewMerchantWizard_MerchantWizard1_cbWizardPanel_ContactTab_ControlUC_ContactGrid_DXPEForm_efnew_EditContact1_ContactTypeCtrl_MultiSelectASPxDropDownEdit_B-1Img')]



click
xpath=//input[contains(@id, 'ViewMerchantWizard_MerchantWizard1_cbWizardPanel_ContactTab_ControlUC_ContactGrid_DXPEForm_efnew_EditContact1_ContactTypeCtrl_MultiSelectASPxDropDownEdit_DDD_DDTC_MultiSelectASPxListBox_LBI4T0 > input[type="checkbox"]')]


avatar
ccox
Master
Master
Posts : 205
Join date : 2012-01-06
Age : 39
Location : Denver, CO

dynamically finding checkbox in multi-select drop down Empty Re: dynamically finding checkbox in multi-select drop down

Tue Feb 21, 2012 11:21 am
Is it failing because it is unable to locate the check box, or is it failing because it is unable to locate the drop down after the check box is selected?

Have you tried using clickAndWait instead of click? Sometimes adding that "AndWait" can help recognize the dropdown. I have also used the "waitForChecked" command to make sure the check box is selected before continuing.

avatar
imfaus
Active particpant
Active particpant
Posts : 13
Join date : 2012-01-13

dynamically finding checkbox in multi-select drop down Empty Re: dynamically finding checkbox in multi-select drop down

Tue Feb 21, 2012 9:42 pm
the workflow is that I initially select the drop down, so I can find this piece the checkbox is embedded in the element...
avatar
zlos7ar
Amateur
Amateur
Posts : 41
Join date : 2012-01-13
Age : 36
Location : Germany

dynamically finding checkbox in multi-select drop down Empty Re: dynamically finding checkbox in multi-select drop down

Tue Feb 21, 2012 9:46 pm
There are several ways to find an element did you try them all ?
1. finding element by ID
2. finding element by name
3. finding element by link text
4. finding elements by accessing the DOM through JavaScript
5. finding element by XPath
6. finding element by css
7. finding elements by their attribute

Did I miss anything ? Smile
I am pretty sure you can probably use something like this xpath=//div[@class='classname'] ---> that will work if the element have unique class and usually when everything else is the same the class is different. Developers also need to have something unique in their elements so I am sure that not everything is the same you just have to find the difference and use on of the above methods to select the element.
Sponsored content

dynamically finding checkbox in multi-select drop down Empty Re: dynamically finding checkbox in multi-select drop down

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