人社练兵比武怎样挣积分 python 源码在线答题源码

Levana ·
更新时间:2024-11-11
· 501 次阅读

###↑↑↑↑↑↑↑↑↑↑↑↑↑ 可以自动答题积分 不明白如何用的可以联系我

#下面2个函数是学练习的 需要用的库为selenium time re pickle
题库需要收集

def dan(): #单选或多选 j = browser.find_element_by_xpath('//*[@id="app"]/section/div[2]/div[4]/div/p[1]').text if j=='当前题型已学完': print('已完') return 1 else: pass x = browser.find_elements_by_css_selector('a') for i in x: if 'A' == i.text: try: i.click() except: pass else: pass time.sleep(0.5) x = browser.find_elements_by_css_selector('a') for i in x: if '查看解析' == i.text: i.click() time.sleep(0.5) else: pass xuan = browser.find_element_by_xpath('//*[@id="app"]/section/div[2]/div[4]/div/div[2]/ul') xuan = xuan.get_attribute('innerHTML') xuan = bs(xuan,'lxml') xuan = xuan.findAll('li') mu = browser.find_element_by_xpath('//*[@id="app"]/section/div[2]/div[4]/div/h1').text try: daan[mu] print('已经有答案') except: an =[] a = browser.find_element_by_xpath('//*[@id="app"]/section/div[2]/div[4]/div/div[3]/p/span[1]').text a = re.sub('正确答案:','',a) a = re.sub(' ','',a) an.append(a) for i in xuan: if i.text[0] in a: an.append(i.text) else: pass daan[mu]= an print(mu) print(an) print(len(daan)) browser.find_element_by_xpath('//*[@id="app"]/section/div[2]/div[4]/div/p/a[1]').click() def pan(): j = browser.find_element_by_xpath('//*[@id="app"]/section/div[2]/div[4]/div/p[1]').text if j=='当前题型已学完': print('已完') return 1 else: pass mu = browser.find_element_by_xpath('//*[@id="app"]/section/div[2]/div[4]/div/h1').text mu = re.sub('\n请输入答案: ','',mu) try: browser.find_element_by_xpath('//*[@id="app"]/section/div[2]/div[4]/div/div[2]/ul/li[1]/a/span').click() except: pass x = browser.find_elements_by_css_selector('a') for i in x: if '查看解析' == i.text: i.click() time.sleep(0.5) else: pass time.sleep(0.3) try: daan[mu] print('已经有答案') except: an =[] try: a = browser.find_element_by_xpath('//*[@id="app"]/section/div[2]/div[4]/div/div[3]/p/span[1]').text except: a = browser.find_element_by_xpath('//*[@id="app"]/section/div[2]/div[4]/div/div[2]/p/span[1]').text a = re.sub('正确答案:','',a) a = re.sub(' ','',a) an.append(a) daan[mu]= an print(mu) print(an) print(len(daan)) browser.find_element_by_xpath('//*[@id="app"]/section/div[2]/div[4]/div/p/a[1]').click() 18923489164 原创文章 104获赞 19访问量 5万+ 关注 私信 展开阅读全文
作者:18923489164



在线答题 源码 Python

需要 登录 后方可回复, 如果你还没有账号请 注册新账号