日韩久久久精品,亚洲精品久久久久久久久久久,亚洲欧美一区二区三区国产精品 ,一区二区福利

Python3.6+selenium2.53.6自動化測試_checkbox

系統 1837 0

環境:

Python3.6+selenium2.53.6自動化測試_checkbox(選擇復選框)_第1張圖片

編輯工具:

瀏覽器:

Python3.6+selenium2.53.6自動化測試_checkbox(選擇復選框)_第2張圖片

?

有問題可以聯系qq:1776376537(html可以加qq要)

# coding:utf-8
#導入包
from common.base import Base
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.support.select import Select
#打開瀏覽器
driver = webdriver.Firefox()
#打開本地html
driver.get("file:///D:/BaiduNetdiskDownload/web%E8%87%AA%E5%8A%A8%E5%8C%96selenium+python/%E8%BD%AF%E4%BB%B6%E5%AE%89%E8%A3%85%E5%8C%85/checkbox.html")
check = Base(driver)
loc1 = ("id","c1")
r1 = check.isSelected(loc1)
print(r1)
che1 = check.click(loc1)
r2 = check.isSelected(loc1)
print(r2)
#全部選中
loc_all = ("xpath",'.//*[@type="checkbox"]')
all = check.findElements(loc_all)
print(all)#list對象
def result(all):
? ? r = []#判斷全部被選中
? ? for i in all:
? ? ? ? ? ? if not i.is_selected():
? ? ? ? ? ? ? ? i.click()
? ? ? ? ? ? ? ? r.append(i.is_selected())#判斷結果
? ? ? ? ? ? else:
? ? ? ? ? ? ? ? r.append(i.is_selected())
? ? return r
# print(result(all))
rrrr = result(all)
print(rrrr)
for i in rrrr:
? ? assert i == True

?

?

?


更多文章、技術交流、商務合作、聯系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 固原市| 龙胜| 沁源县| 海南省| 阜平县| 中山市| 利川市| 偃师市| 郑州市| 奇台县| 政和县| 舒兰市| 昂仁县| 南漳县| 洛川县| 尉氏县| 铜梁县| 余干县| 岳普湖县| 天门市| 澳门| 芦山县| 涟水县| 琼海市| 龙门县| 神木县| 北辰区| 手游| 古交市| 商都县| 阳高县| 措美县| 清涧县| 西峡县| 招远市| 沧州市| 银川市| 项城市| 东乡族自治县| 来凤县| 乌兰县|