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
4 components of selenium
selenium IDE: record and playback; used for prototype testing
selenium RC(remote control): a test tool that allows you to write automated web app ui test
selenium WebDriver
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
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)
版权归原作者 自动化测试工程师 所有, 如有侵权,请联系我们删除。