栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

Python Automation Test - Chapter 2: Selenium

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Python Automation Test - Chapter 2: Selenium

一、环境准备

1. install selenium:

pip install selenium

2. install chromedriver:

brew install chromedriver

3. confirm the version of chromedrive:

chromedriver --version

二、实例2

test google search in selenium

# 1. go to google.com
# 2. type in a search 'puppies'
# 3. submit or enter the search
# 4. assert we got a search page for puppies

1. how to find search box element in dev tool?

 (找到element)

2. submit or enter the search:

the name of "google search" element is unique:

 

to verify, we can execute this code in console:

$("[name='btnK']") 

 

3. example:

4. result:

 

三、statsroyale.com:

1. find cards page:

 verify it's unique:

2. find the element of the specific image:

 

$("[href*='Ice+Spirit']")

Note: ' *= ' means 'contains'

(want to get the href that contains the word "ice spirit")

 

3. example:

4. result:

 

 

 

 

 

 

 

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/844460.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号