Selecting a dynamic checkbox in selenium using regex
I am trying to select a checkbox whose ids are generated dynamically but couldn't solve it.
Tried followingSelenium.check("id=regexp:ctl00_cphMa开发者_Python百科in_cbx_[a-zA-Z0-9_,]*")
Selenium.check("xpath=(//input[@type='checkbox'])[position()=1]")
Also this check box has only dynamic id, no name etc. any idea what I am doing wrong.
Regards
have you tried selenium.check('xpath=//input[@type='checkbox' and starts-with(@id,'ctl00_cphMain_cbx_')])
That should get what you are after
精彩评论