admin管理员组

文章数量:1794759

selenium python 入门教程

selenium python 入门教程

 2. Getting Started — selenium python Bindings 2 documentation

2.1. Simple Usage

If you have installed Selenium Python bindings, you can start using it from Python like this.

from selenium import webdriver from selenium.webdrivermon.keys import Keys from selenium.webdrivermon.by import By driver = webdriver.Firefox() driver.get("www.python") assert "Python" in driver.title elem = driver.find_element(By.NAME, "q") elem.clear() elem.send_keys("pycon") elem.send_keys(Keys.RETURN) assert "No results found." not in driver.page_source driver.close()

The above script can be saved into a file (eg:- python_org_search.py), then it can be run like this:

python python_org_search.py

The python which you are running should have the selenium module installed.

 

本文标签: 入门教程seleniumPython