开发者

Selecting a dynamic checkbox in selenium using regex

开发者 https://www.devze.com 2023-04-02 03:41 出处:网络
I am trying to select a checkbox whose ids are generated dynamically but couldn\'t solve it. Tried following

I am trying to select a checkbox whose ids are generated dynamically but couldn't solve it.

Tried following

Selenium.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

0

精彩评论

暂无评论...
验证码 换一张
取 消