python3 网页下拉框和悬浮框操作基础汇总

#悬浮定位操作

from selenium.webdrier import ActionChains

#浏览器实例化

#定位移动的位置赋给一个参数

ActionChains(浏览器).move_to_element(定位移动的位置).perform()

#下拉框

from selenium import webdriver

from selenium.webdriver.support.select import Select

fx=webdriver.Firefox()

#定位下拉框和下拉框内元素三种方法

Select(fx.find_element_by_id('xx').select_by_value('xx'))

Select(fx.find_element_by_id('xx').select_by_index('xx'))

Select(fx.find_element_by_id('xx').select_by_visible_text('xx'))

逆风的方向更适合飞翔,不怕千万人阻挡,只怕自己投降!
原文地址:https://www.cnblogs.com/jackzz/p/9125726.html