python selenium-related operations

selenium :

  It is a tool for Web application testing. Selenium tests run directly in the browser, just as real users in the same operation. Supported browsers include IE (7, 8, 9, 10, 11), Mozilla Firefox , Safari, Google Chrome, Opera and so on. The main features of this tool include: testing and browser compatibility - Test your application to see if the well had to work on different browsers and operating systems. Test system functions - create regression testing test software functionality and user requirements. Support automatically record test scripts and actions in different languages automatically generate .Net, Java, Perl and so on.

According Selenium Home said, compared with other testing tools, the biggest benefit is the use of Selenium:
Selenium tests run directly in the browser, just as real users do the same. Selenium tests can Internet Explorer on Windows, Linux and Macintosh, Chrome and Firefox run. Other testing tools can not cover so many platforms. Selenium and running in a browser test, there are many other benefits.
The following are the two main benefits:
Selenium test script written by imitating the user operation, the application can be tested from the end user perspective. By running different browsers tested, easier to detect incompatibilities browser. Selenium core, also called Browser BOT , is written in JavaScript. This makes test scripts can be run in a supported browser. browser bot responsible for executing commands received from the test script to the test script using either HTML table layout prepared, either use one of the supported programming language.
 
Selenium 2.0 browser for the following  [2]  :
  • Google Chrome
  • Internet Explorer 7, 8, 9, 10, 11
  • Firefox
  • Safari
  • Opera
  • HtmlUnit
  • phantomjs
  • Android
  • iOS
Selenium 1.0 for the following browsers:
Browser
Selenium IDE
Selenium Remote Control
Selenium Core
Selenium 2/Webdriver API
Firefox 10
Record and playback tests
Start browser, run tests
Run tests
Run tests
Firefox 9
Record and playback tests
Start browser, run tests
Run tests
Run tests
Firefox 8
Record and playback tests
Start browser, run tests
Run tests
Run tests
Firefox 7
Record and playback tests
Start browser, run tests
Run tests
Run tests
Firefox 6
Record and playback tests
Start browser, run tests
Run tests
Run tests
Firefox 5
Record and playback tests
Start browser, run tests
Run tests
Run tests
Firefox 4
Record and playback tests
Start browser, run tests
Run tests
Run tests
Firefox 3.6
Record and playback tests
Start browser, run tests
Run tests
Run tests
Firefox 3
Record and playback tests
Start browser, run tests
Run tests
not supported
IE 9
not supported
Start browser, run tests
Run tests
Run tests
IE 8
not supported
Start browser, run tests
Run tests
Run tests
IE 7
not supported
Start browser, run tests
Run tests
Run tests
Safari 3
not supported
Start browser, run tests
Run tests
not supported
Safari 2
not supported
Start browser, run tests
Run tests
not supported
Opera 9
not supported
Start browser, run tests
Run tests
Run tests
Opera 8
not supported
Start browser, run tests
Run tests
Run tests
Chrome
not supported
Start browser, run tests***
Run tests***
Run tests***
Others
not supported
Partial support possible*
Run tests**
not supported

 

 

selenium-related operations

Installation: pip install selenium

Supported browsers:

  

 

Import module:

from selenium  import webdriver

Browser plug-ins (Google): link: https: //pan.baidu.com/s/17xk-6GXeach_HZTWo-AUqg 
extraction code: vdlj 

Start your browser:

 

bro = webdriver.Chrome(executable_path = r"F:\chromedriver.exe")

Analog request Address:

bro.get("https://koudashijie.com/teachers/classes")

Find the input box, to get the front page ID

text_input = bro.find_element_by_id('kw')

Typing

text_input.send_keys ( "steam maker culture")

Analog submit button

login_btn = bro.find_element_by_id("su").click()

Get page

bro.page_source

 

 

Guess you like

Origin www.cnblogs.com/wqzn/p/11130001.html