Python+Selenium定位悬停元素总是报错,什么原因
1个回答
展开全部
Python+Selenium定位悬停元素总是报错,什么原因呢?
#coding=utf-8
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
import os,time
driver=webdriver.Chrome()
driver.get("ht 085/zfgtaiAdmin/Product/loginBackground.jsp")
time.sleep(3)
#driver.maximize_window()
driver.find_element_by_id("username").clear()
driver.find_element_by_id("username").send_keys("15112304365")
driver.find_element_by_id("username").send_keys(Keys.TAB)
time.sleep(4)
driver.find_element_by_id("password").send_keys("System.out.print")
driver.find_element_by_css_selector("input[type=\"button\"]").click()
driver.find_element_by_link_text("产品管理").move_to_element("产品管理").perform()
#WebDriverWait(driver,10).until(lambda the_driver)
WebDriverWait(driver,10).until(lambda the_driver:the_driver.find_element_by_link_text("产品管理").is_displayed())
menu= driver.find_element_by_link_text("产品管理").find_element_by_link_text("产品发布")
webdriver.ActionChains(driver).move_to_element(menu).perform()
#coding=utf-8
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
import os,time
driver=webdriver.Chrome()
driver.get("ht 085/zfgtaiAdmin/Product/loginBackground.jsp")
time.sleep(3)
#driver.maximize_window()
driver.find_element_by_id("username").clear()
driver.find_element_by_id("username").send_keys("15112304365")
driver.find_element_by_id("username").send_keys(Keys.TAB)
time.sleep(4)
driver.find_element_by_id("password").send_keys("System.out.print")
driver.find_element_by_css_selector("input[type=\"button\"]").click()
driver.find_element_by_link_text("产品管理").move_to_element("产品管理").perform()
#WebDriverWait(driver,10).until(lambda the_driver)
WebDriverWait(driver,10).until(lambda the_driver:the_driver.find_element_by_link_text("产品管理").is_displayed())
menu= driver.find_element_by_link_text("产品管理").find_element_by_link_text("产品发布")
webdriver.ActionChains(driver).move_to_element(menu).perform()
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询