selenium学习笔记

目录

1. what is selenium: 

2. components of selenium

3. selenium WebDriver

4. element

5. locate element

6. beautiful soup


1. what is selenium: 

a set of tools and libraries that automate web browser actions

通过web-driver packages to control browser and emulate user oriented actions

2. components of selenium

selenium学习笔记_第1张图片

4 components of selenium

1) selenium IDE: record and playback; used for prototype testing

2) selenium RC(remote control): a test tool that allows you to write automated web app ui test

3) selenium WebDriver

4) selenium Grid: used for parallel or distributive testing

3. selenium WebDriver

WebDriver API: drive the browser natively, as a user would either locally or on a remote machine using the selenium server

when executing a test script using WebDriver:

-> executer one selenium command 

-> generate http request and send to browser driver

-> driver receive http request through the http server

-> the server decides all the steps to perform instructions which are executed on the browser

-> execution status is sent back to the http server which is subsequently sent back to the automation script

4. element

elements: everything you see on a page is an element(field, link, text, image...)

dynamic elements: ID, name, class or css-attributes are not fixed, will change whoever page is reloaded

5. locate element

selenium学习笔记_第2张图片

selenium学习笔记_第3张图片

6. beautiful soup

pip install beautifulsoup4

page_source_overview = driver.get_source

from bs4 import BeautifulSoup

soup = BeautifulSoup(page_source_overview, 'lxml')

title_finder = soup.find_all('span', class_='title')

for title in title_finder:

print(title.string)

你可能感兴趣的:(selenium,学习,测试工具)