一、环境准备
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:
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)