MCPcopy
hub / github.com/TechXueXi/TechXueXi / radio_check

Method radio_check

SourcePackages/pdlearn/mydriver.py:432–459  ·  view source on GitHub ↗
(self, check_options)

Source from the content-addressed store, hash-verified

430 return options
431
432 def radio_check(self, check_options):
433 opts = self.driver.find_elements_by_class_name("choosable")
434 for check_option in check_options:
435 try:
436 # self.driver.find_element_by_xpath(
437 # '//*[@id="app"]/div/div[*]/div/div[*]/div[*]/div[*]/div[contains(text(), "' + check_option + '.")]').click()
438 for opt in opts:
439 if opt.text[0] == check_option:
440 opt.click()
441 except Exception as e:
442 print("点击", check_option, '失败!')
443 self.check_delay()
444 submit = WebDriverWait(self.driver, 15).until(
445 lambda driver: driver.find_element_by_class_name("action-row").find_elements_by_xpath("button"))
446 if len(submit) > 1:
447 self.click_xpath(
448 '//*[@id="app"]/div/div[2]/div/div[6]/div[2]/button[2]')
449 print("成功点击交卷!")
450 else:
451 self.click_xpath(
452 '//*[@id="app"]/div/div[*]/div/div[*]/div[*]/button')
453 print("点击进入下一题")
454 time.sleep(1)
455 if self.driver.find_elements_by_class_name("nc-mask-display"):
456 # self.swiper_valid()
457 # print("出现滑块验证。")
458 gl.pushprint("出现滑块验证,本次答题结束")
459 raise Exception("出现滑块验证。")
460
461 # 滑块验证
462 def swiper_valid(self):

Callers 4

dailyFunction · 0.95
weeklyFunction · 0.95
zhuanxiangFunction · 0.95
answer_questionFunction · 0.80

Calls 2

check_delayMethod · 0.95
click_xpathMethod · 0.95

Tested by

no test coverage detected