问题
I am trying to select a checkbox whose ids are generated dynamically but couldn't solve it.
Tried following
Selenium.check("id=regexp:ctl00_cphMain_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
回答1:
have you tried selenium.check('xpath=//input[@type='checkbox' and starts-with(@id,'ctl00_cphMain_cbx_')])
That should get what you are after
来源:https://stackoverflow.com/questions/7280972/selecting-a-dynamic-checkbox-in-selenium-using-regex