![](/img/trans.png)
[英]Selenium cssSelector works in IDE but not in Webdriver
[英]Selenium WebDriver - cssselector for locating input + onclick
我有以下復選框:
<input id="outerLabor102" name="ctl02$chkSelectLabor" onclick="chkChildLabor(this);chkIntervallineChild(this);" type="checkbox">
我更是一個xpath家伙,但是由於我想提供一個選擇器,該選擇器將通過輸入ID加上onclick屬性來找到該復選框,因此我認為css選擇器應該可以,但是我找不到方法制定一個。
我在想類似的東西:
(By.cssSelector("input[id=outerLabor102]input[onclick^=chkChildLabor(this);chkIntervallineChild(this);]")
感謝您檢查我的問題。
我不會依賴onclick
屬性,但是,為了舉例說明:
input#outerLabor102[onclick^=chkChildLabor]
其中^=
是起始符號。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.