You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* [py] Remove blank line in tox.ini
* [py] Update instructions for docs
* [py] Bump Sphinx and Jinja2 versions for building docs
* [py] Change permissions of index.rst
* [py] Update instructions for building docs
* [py] Update Python documentation (modernization)
* [py] fix typos in README
* [py] Fix theme name
* [py] Update browser names in README
* [py] Add virtual env name
* [py] Change Sphinx version for docs
* [py] tiny fix in README
Several browsers/drivers are supported (Firefox, Chrome, Internet Explorer), as well as the Remote protocol.
24
+
Several browsers/drivers are supported (Firefox, Chrome, Edge, Safari), as well as the Remote protocol.
23
25
24
26
Supported Python Versions
25
27
=========================
@@ -33,21 +35,22 @@ If you have `pip <https://pip.pypa.io/>`_ on your system, you can simply install
33
35
34
36
pip install -U selenium
35
37
36
-
Alternately, you can download the source distribution from `PyPI <https://pypi.org/project/selenium/#files>`, unarchive it, and run::
37
-
38
-
python -m pip install .
39
-
40
-
Note: You may want to consider using `virtualenv <http://www.virtualenv.org/>`_ to create isolated Python environments.
38
+
You may want to consider using a `virtual environment <https://packaging.python.org/en/latest/guides/installing-using-pip-and-virtual-environments>`_
39
+
to create isolated Python environments.
41
40
42
41
Drivers
43
42
=======
44
43
45
-
Selenium requires a driver to interface with the chosen browser. Firefox,
46
-
for example, requires `geckodriver <https://github.com/mozilla/geckodriver/releases>`_, which needs to be installed before the below examples can be run. Make sure it's in your `PATH`, e. g., place it in `/usr/bin` or `/usr/local/bin`.
44
+
Selenium requires a driver to interface with the chosen browser (chromedriver, edgedriver, geckodriver, etc).
47
45
48
-
Failure to observe this step will give you an error `selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH.`
46
+
In older versions of Selenium, it was necessary to install and manage these drivers yourself. You had to make sure the driver
47
+
executable was available on your system `PATH`, or specified explicitly in code. Modern versions of Selenium handle browser and
48
+
driver installation for you with `Selenium Manager <https://www.selenium.dev/documentation/selenium_manager>`_. You generally
49
+
don't have to worry about driver installation or configuration now that it's done for you when you instantiate a WebDriver.
50
+
Selenium Manager works with most supported platforms and browsers. If it doesn't meet your needs, you can still install and
51
+
specify browsers and drivers yourself.
49
52
50
-
Other supported browsers will have their own drivers available. Links to some of the more popular browser drivers follow.
53
+
Links to some of the more popular browser drivers:
Selenium WebDriver is often used as a basis for testing web applications. Here is a simple example using Python's standard `unittest <http://docs.python.org/3/library/unittest.html>`_ library:
110
+
Selenium WebDriver is often used as a basis for testing web applications. Here is a simple example using Python's standard `unittest <http://docs.python.org/3/library/unittest.html>`_ library:
103
111
104
112
.. code-block:: python
105
113
106
114
import unittest
107
115
from selenium import webdriver
108
116
117
+
109
118
classGoogleTestCase(unittest.TestCase):
110
119
111
120
defsetUp(self):
112
-
self.browser= webdriver.Firefox()
113
-
self.addCleanup(self.browser.quit)
121
+
self.driver= webdriver.Firefox()
122
+
self.addCleanup(self.driver.quit)
114
123
115
124
deftest_page_title(self):
116
-
self.browser.get('http://www.google.com')
117
-
self.assertIn('Google', self.browser.title)
125
+
self.driver.get('https://www.google.com')
126
+
self.assertIn('Google', self.driver.title)
118
127
119
128
if__name__=='__main__':
120
129
unittest.main(verbosity=2)
@@ -143,9 +152,9 @@ Contributing
143
152
144
153
- Create a branch for your work
145
154
- Ensure `tox` is installed (using a `virtualenv` is recommended)
0 commit comments