setup-selenium-testing 0.1.4__tar.gz → 0.1.6__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: setup-selenium-testing
3
- Version: 0.1.4
3
+ Version: 0.1.6
4
4
  Summary: Setup Selenium for automation testing
5
5
  Home-page: https://github.com/bandophahita/setup_selenium
6
6
  License: MIT
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "setup-selenium-testing"
3
- version = "0.1.4"
3
+ version = "0.1.6"
4
4
  description = "Setup Selenium for automation testing"
5
5
  authors = ["Marcel Wilson <trenchrats@gmail.com>"]
6
6
  license = "MIT"
@@ -8,7 +8,7 @@ import os as os
8
8
  from enum import Enum
9
9
  from typing import TYPE_CHECKING, Optional, Union
10
10
 
11
- from selenium import webdriver
11
+ from selenium import __version__, webdriver
12
12
  from selenium.common.exceptions import NoSuchWindowException, WebDriverException
13
13
  from selenium.webdriver.chrome.service import Service as ChromeService
14
14
  from selenium.webdriver.common.selenium_manager import SeleniumManager
@@ -28,6 +28,11 @@ if TYPE_CHECKING:
28
28
  webdriver.FirefoxOptions, webdriver.ChromeOptions, webdriver.EdgeOptions
29
29
  ]
30
30
 
31
+ NEW_SELENIUM = False
32
+ if Version(__version__) >= Version("4.20.0"):
33
+ NEW_SELENIUM = True
34
+
35
+
31
36
  __all__ = ["SetupSelenium"]
32
37
 
33
38
 
@@ -171,7 +176,11 @@ class SetupSelenium:
171
176
  driver_version = driver_version or None
172
177
 
173
178
  sm = SeleniumManager()
174
- args = [f"{sm.get_binary()}", "--browser", browser]
179
+
180
+ if NEW_SELENIUM:
181
+ args = [f"{sm._get_binary()}", "--browser", browser]
182
+ else:
183
+ args = [f"{sm.get_binary()}", "--browser", browser] # type: ignore[attr-defined]
175
184
 
176
185
  if browser_version:
177
186
  args.append("--browser-version")
@@ -187,7 +196,12 @@ class SetupSelenium:
187
196
  args.append("--browser-path")
188
197
  args.append(browser_path)
189
198
 
190
- output = sm.run(args)
199
+ if NEW_SELENIUM:
200
+ args.append("--output")
201
+ args.append("json")
202
+ output = sm._run(args)
203
+ else:
204
+ output = sm.run(args) # type: ignore[attr-defined]
191
205
  driver_path = output["driver_path"]
192
206
  browser_path = output["browser_path"]
193
207