我想点击并按住网页中的栏,然后将其移到右边
这是我的密码:
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
browser = webdriver.Ie('IEDriverServer.exe')
url = 'https://verify.meituan.com/v2/web/general_page?action=spiderindefence&requestCode=507e224b8f0f447793ad3a03830984c8&platform=1000&adaptor=auto&succCallbackUrl=https%3A%2F%2Foptimus-mtsi.meituan.com%2Foptimus%2FverifyResult%3ForiginUrl%3Dhttp%253A%252F%252Fwww.dianping.com%252Fsearch%252Fkeyword%252F1%252F0_%2525E5%252590%25258D%2525E5%252588%25259B%2525E4%2525BC%252598%2525E5%252593%252581%252F10&theme=dianping'
browser.get(url)
slider = browser.find_element_by_xpath("//div[@id='yodaBoxWrapper']//div[@id='yodaMoveingBar']")
ActionChains(browser).click_and_hold(slider).move_by_offset(xoffset=50, yoffset=0).perform()
酒吧不动了
我的代码怎么了
非常感谢
在您的代码中,您正试图对web元素进行一些操作,若您手动查看站点如何加载,您将发现在页面上呈现HTML组件需要时间
您需要等待元素在页面上呈现,并进行额外检查,以确保其可单击,您可以使用下面的代码执行此操作。有关最佳实践的完整列表,请查看this answer
下面是完整的代码
相关问题 更多 >
编程相关推荐