python登录豆瓣

网友投稿 293 2022-08-27


python登录豆瓣

from selenium import webdriverimport timefrom selenium.webdriver import ActionChainsdriver = webdriver.Chrome()driver.get('1200)login_frame = driver.find_element_by_xpath('//div[@class="login"]/iframe')driver.switch_to.frame(login_frame)time.sleep(2)driver.find_element_by_xpath('//li[@class="account-tab-account"]').click()driver.find_element_by_id('username').send_keys('xxxxx')driver.find_element_by_id('password').send_keys('xxxx')driver.find_element_by_class_name('btn-account').click()time.sleep(4)def get_tracks(distance): v = 0 t = 0.5 tracks = [] current = 0 mid = distance*4/5 while current < distance: if current < mid: a = 2 else: a = -3 v0 = v s = v0*t + 0.5*a*(t**2) current += s tracks.append(round(s)) v = v0 + a*t return tracksauth_frame = driver.find_element_by_id('tcaptcha_iframe')driver.switch_to.frame(auth_frame)element = driver.find_element_by_xpath('//*[@id="tcaptcha_drag_thumb"]')ActionChains(driver).click_and_hold(on_element=element).perform()ActionChains(driver).move_to_element_with_offset(to_element=element,xoffset=180,yoffset=0).perform()tracks = get_tracks(25)for track in tracks: ActionChains(driver).move_by_offset(xoffset=track,yoffset=0).perform()time.sleep(0.6)ActionChains(driver).release().perform()


版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:Python字符串格式化输出语法汇总(python字符串的格式化输出)
下一篇:Python 设计模式:适配器模式(python下载安装教程)
相关文章

 发表评论

暂时没有评论,来抢沙发吧~