From ad08d811af4afa2aac4fba47f1d41caf5af884ca Mon Sep 17 00:00:00 2001 From: Jonas Rebmann Date: Wed, 27 Nov 2024 09:53:03 +0100 Subject: [PATCH] docs: webdriver: update code for selenium 4 The desired_capabilities property has been deprecated in Selenium 4.0 Alpha 7 and dropped in Selenium 4.17.0. Use options.capabilities instead. --- docs/webdriver.md | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/docs/webdriver.md b/docs/webdriver.md index 6c9c7022..e7187b06 100644 --- a/docs/webdriver.md +++ b/docs/webdriver.md @@ -29,17 +29,15 @@ In the python script: ```python from selenium import webdriver -def capabilities(): - return { - "wpe:browserOptions": { - "binary": "/usr/bin/cog", - "args": ["--automation", "--platform=wl"], - } - } +options = webdriver.WPEWebKitOptions() +options.capabilities.clear() +options.binary_location = "/usr/bin/cog" +options.add_argument("--automation") +options.add_argument("--platform=wl") driver = webdriver.Remote( command_executor="http://YOUR_DEVICE_IP:8088", - desired_capabilities=capabilities(), + options=options, ) ``` @@ -63,4 +61,4 @@ pointer = actions.pointer_action pointer.move_to(board, x, y) pointer.click() actions.perform() -``` \ No newline at end of file +```