selenium利用actionchains方法,模拟鼠标悬浮到指定的元素,获取卡片信息

from selenium import webdriver
from selenium.webdriver import ActionChains
from selenium.webdriver.common.keys import Keys
import time
driver = webdriver.Chrome('/Users/jocelyn.xu/Downloads/chromedriver')

driver.maximize_window()
driver.implicitly_wait(10)

driver.get('https://crm.xiaoman.cn')

#登录到crm
driver.find_element_by_css_selector('#email').send_keys('xxxx')
driver.find_element_by_css_selector('#password').send_keys('xxxx')
driver.find_element_by_css_selector('button[type=submit]').click()

#print(driver.get_cookies())
#获取菜单栏的所有项,点击第7个进入到报价单列表
menu = driver.find_element_by_css_selector('.common-sider-menu li:nth-child(7)'
menu.click()
#点击查看报价单的详情
driver.find_element_by_css_selector('.quotation-list ul:nth-child(2)').click()

customer = driver.find_element_by_css_selector('.quotation-info-wrap li:nth-child(3) a')
print(customer)
action = ActionChains(driver)
#鼠标悬浮到客户上面,查看客户卡片
action.move_to_element(customer).perform()


你可能感兴趣的:(python学习)