我正在尝试单击一个复选框,以下是我尝试过的一些操作:
// label [string()=('通知用户')] / i
// div [@ class ='b-checkbox']
// div [@ class ='b-checkbox'] // label // input [@ type ='checkbox']
<div class="b-checkbox"><label class=""><input type="checkbox" value="on"><!-- react-text: 563 -->Notify user<!-- /react-text --><i class="b-custom"></i></label></div><div class="b-body b-mh-medium"><div class="b-body b-mv-small"><fieldset class="b-form-group"><label class="currency-input-label" for="currency-input-field"><span class="currency-input-label" disabled=""><span>When should we notify you that funds are low?</span></span><br><span class="b-prepend">$</span><input type="number" class="b-inline b-w-medium b-form-control" id="currency-input-field" value="" disabled=""><span class="b-text-base currency-input-grey-text">Remaining</span></label><span class="b-help b-hide"></span><span class="b-error b-hide"></span></fieldset></div></div>
但是我得到了元素不易出错的错误。有什么建议吗?预先感谢。
答案 0 :(得分:0)
尝试使用elif
:
import random
Olist = []
while True:
counter = 0
counter2 = 0
print("\nWelcome to exercise 05")
InH1 = str(input("\nDo you wish to continue? (y/n):"))
if InH1 == 'y':
list1 = random.sample(range(30), 11)
list2 = random.sample(range(30), 9)
print("\n<><>Two random lists have been generated.<><>")
print(list1)
print(list2)
max_index = len(list2)-1
print("\n<><>Max index has been generated.<><>")
print(max_index)
InD = str(input("\nStart the func? (y/n):"))
if InD == 'n':
break
if InD == 'y':
print(list1[counter2])
print(list2[counter])
while counter < max_index:
if counter2 == 11:
print(Olist)
InL = str(input("\nEnter any key to return to the start of the program,\
or,\n enter 'q' to break the program."))
if InL == 'q':
break
if list1[counter2] == list2[counter]:
Olist.append(list2[counter])
counter += 1
else:
counter += 1
if InH1 == 'n':
break
或Actions
:
WebElement element = driver.findElement(By.xpath("//div[@class='b-checkbox']//label//input[@type='checkbox']"));
Actions action = new Actions(driver);
action.moveToElement(element).click(element).build().perform();
正在导入:
JavascriptExecutor