无标题文章

2018-12-27  本文已影响0人  额_b385

from seleniumimport webdriver

from selenium.webdriver.common.action_chainsimport ActionChains# 鼠标悬浮

from selenium.webdriver.support.uiimport Select

import time

driver = webdriver.Chrome()

driver.implicitly_wait(10)

url ="http://web.926.net.cn"

driver.get(url)

driver.find_element_by_class_name("ant-menu-item").click()

driver.find_element_by_id("手机号").clear()

driver.find_element_by_id("手机号").send_keys("18772606900")

driver.find_element_by_id("密码").clear()

driver.find_element_by_id("密码").send_keys("123456")

# 登陆

driver.find_element_by_xpath("//button[@class='ant-btn login-form-button ant-btn-primary']").click()

time.sleep(5)

# driver.find_elements_by_xpath(".//div[@class='ant-layout']/a[@class='ant-dropdown-trigger']").click()

mouse = driver.find_element_by_xpath("//i[@class='anticon anticon-down']")

ActionChains(driver).move_to_element(mouse).perform()

element_artist = driver.find_element_by_link_text("切换企业")

element_artist.click()

# 切换至其他企业

time.sleep(2)

driver.find_element_by_xpath("//div[@class='ant-select-selection__rendered']").click()

# driver.find_element_by_class_name("ant-select-selection-selected-value").click()

time.sleep(1)

# driver.find_element_by_xpath("/html/body/div[4]/div/div/div/ul/li[3]").click()

# todo 这个下拉框不知道怎么选中不了

s1 = Select(driver.find_element_by_xpath(

"//ul[@class='ant-select-dropdown-menu  ant-select-dropdown-menu-root ant-select-dropdown-menu-vertical']"))

s1.select_by_index(1)

# 点击切换,切换成功

driver.find_element_by_link_text("切换").click()

driver.find_element_by_link_text("926云平台").click()

上一篇下一篇

猜你喜欢

热点阅读