from selenium import webdriver
from selenium.webdriver import ActionChains
def isExistsByXpath(xpath):
try:
element = driver.find_element_by_xpath(xpath)
return True
except Exception as e:
return False
driver = webdriver.Firefox()
driver.implicitly_wait(30)
driver.get("http://callback.ganji.com/firewall/valid/920573663.do?namespace=ganji_hy_detail_pc&url=http%3A%2F%2Fanshan.ganji.com%2Fzhiyepeixun%2F944875012x.htm")
while not isExistsByXpath('//img[@class="dvc-captcha__bgImg"]'):
driver.find_element_by_xpath('//input[@id="btnSubmit"]').click()
element = driver.find_element_by_xpath('//img[@class="dvc-captcha__bgImg"]')
action = ActionChains(driver)
action.move_to_element(element).context_click(element).perform()
如何用鼠标右键下载图片?我试着用“发送钥匙”,但没用。在
请帮忙
试试这样的方法
相关问题 更多 >
编程相关推荐