]> xn--ix-yja.es Git - alex.git/commitdiff
No longer recommend Selenium
authoralex <alex@pdp7.net>
Fri, 22 Apr 2022 18:18:54 +0000 (20:18 +0200)
committeralex <alex@pdp7.net>
Fri, 22 Apr 2022 18:18:54 +0000 (20:18 +0200)
programming/python/scraping_with_selenium_on_docker.md

index f5dd1cdd0165039042ed80f3110a567262385d68..ec22ee50836260a25698af68e39ef70749215f57 100644 (file)
@@ -1,39 +1,5 @@
-Check that Docker is installed and your user can run Docker:
+Don't use Selenium, use [Playwright](https://playwright.dev/python/):
 
-```
-$ docker run --rm hello-world
-```
-
-Docker should print a success message, if not, review your Docker installation.
-
-Create a virtualenv and install `testcontainers` with `selenium` support:
-
-```
-$ python3 -m venv selenium_testcontainers_venv
-$ . selenium_testcontainers_venv/bin/activate
-$ pip install -U pip
-$ pip install testcontainers[selenium]
-```
-
-Use in a Python terminal:
-
-```
-$ python
->>> from testcontainers import selenium
->>> from selenium.webdriver import DesiredCapabilities
->>> chrome = selenium.BrowserWebDriverContainer(DesiredCapabilities.CHROME)
->>> chrome.start()
->>> webdriver = chrome.get_driver()
->>> ...
-```
-
-Use in code:
-
-```
-from testcontainers import selenium
-from selenium.webdriver import DesiredCapabilities
-
-with selenium.BrowserWebDriverContainer(DesiredCapabilities.CHROME) as chrome:
-    webdriver = chrome.get_driver()
-    ...
-```
+* Playwright automatically sets up headless browsers.
+* Provides convenient abstractions for locating elements in a page (mostly no XPath required. It can match "intelligently" using text).
+* Has a handy UI tool that records your actions in a browser and writes equivalent *readable* Playwright code.