Package: selenium-duration-50ms
IntroductionPython language bindings for Selenium WebDriver.Theseleniumpackage is used to automate web browser interaction from Python.Home:https://selenium.devDocs:selenium package APIDev:https://github.com/SeleniumHQ/SeleniumPyPI:https://pypi.org/project/selenium/IRC:#seleniumchannel on freenodeSeveral browsers/drivers are supported (Firefox, Chrome, Internet Explorer), as well as the Remote protocol.Supported Python VersionsPython 3.7+InstallingIf you havepipon your system, you can simply install or upgrade the Python bindings:pip install -U seleniumAlternately, you can download the source distribution fromPyPI(e.g. selenium-4.0.0b3.tar.gz), unarchive it, and run:python setup.py installNote: You may want to consider usingvirtualenvto create isolated Python environments.DriversSelenium requires a driver to interface with the chosen browser. Firefox,
for example, requiresgeckodriver, which needs to be installed before the below examples can be run. Make sure it’s in yourPATH, e. g., place it in/usr/binor/usr/local/bin.Failure to observe this step will give you an errorselenium.common.exceptions.WebDriverException: Message: ‘geckodriver’ executable needs to be in PATH.Other supported browsers will have their own drivers available. Links to some of the more popular browser drivers follow.Chrome:https://chromedriver.chromium.org/downloadsEdge:https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/Firefox:https://github.com/mozilla/geckodriver/releasesSafari:https://webkit.org/blog/6900/webdriver-support-in-safari-10/Example 0:open a new Firefox browserload the page at the given URLfromseleniumimportwebdriverbrowser=webdriver.Firefox()browser.get('http://selenium.dev/')Example 1:open a new Firefox browserload the Yahoo homepagesearch for “seleniumhq”close the browserfromseleniumimportwebdriverfromselenium.webdriver.common.byimportByfromselenium.webdriver.common.keysimportKeysbrowser=webdriver.Firefox()browser.get('http://www.yahoo.com')assert'Yahoo'inbrowser.titleelem=browser.find_element(By.NAME,'p')# Find the search boxelem.send_keys('seleniumhq'+Keys.RETURN)browser.quit()Example 2:Selenium WebDriver is often used as a basis for testing web applications.  Here is a simple example using Python’s standardunittestlibrary:importunittestfromseleniumimportwebdriverclassGoogleTestCase(unittest.TestCase):defsetUp(self):self.browser=webdriver.Firefox()self.addCleanup(self.browser.quit)deftestPageTitle(self):self.browser.get('http://www.google.com')self.assertIn('Google',self.browser.title)if__name__=='__main__':unittest.main(verbosity=2)Selenium Server (optional)For normal WebDriver scripts (non-Remote), the Java server is not needed.However, to use Selenium Webdriver Remote or the legacy Selenium API (Selenium-RC), you need to also run the Selenium server.  The server requires a Java Runtime Environment (JRE).Download the server separately, from:http://selenium-release.storage.googleapis.com/4.0/selenium-server-standalone-4.0.0.jarRun the server from the command line:java -jar selenium-server-standalone-4.0.0.jarThen run your Python client scripts.Use The Source Luke!View source code online:official:https://github.com/SeleniumHQ/selenium/tree/trunk/py