Skip to content

Commit 5172332

Browse files
Merge pull request #620 from AutomationSolutionz/electron
ChromeDriver manage for Electron app
2 parents 49ddd73 + 9851700 commit 5172332

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

Framework/Built_In_Automation/Web/Selenium/BuiltInFunctions.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,7 @@ def Open_Electron_App(data_set):
425425
try:
426426
desktop_app_path = ""
427427
driver_id = ""
428+
chrome_version = ""
428429
for left, _, right in data_set:
429430
left = left.replace(" ", "").replace("_", "").replace("-", "").lower()
430431
if "windows" in left and platform.system() == "Windows":
@@ -435,6 +436,8 @@ def Open_Electron_App(data_set):
435436
desktop_app_path = right.strip()
436437
elif left == "driverid":
437438
driver_id = right.strip()
439+
elif left == "chrome:version":
440+
chrome_version = right.strip()
438441

439442
if not desktop_app_path:
440443
CommonUtil.ExecLog(
@@ -461,7 +464,20 @@ def Open_Electron_App(data_set):
461464

462465
opts = Options()
463466
opts.binary_location = desktop_app_path
464-
selenium_driver = webdriver.Chrome(opts, Service())
467+
opts.add_argument("--remote-debugging-port=9222")
468+
# service = Service(executable_path=electron_chrome_path)
469+
arch = platform.machine().lower()
470+
if platform.system() == "Darwin" and arch == "arm64":
471+
os.environ['WDM_ARCHITECTURE'] = 'arm64'
472+
elif platform.system() == "Windows" and arch not in ("amd64", "x86_64"):
473+
os.environ['WDM_ARCHITECTURE'] = 'x32'
474+
else:
475+
os.environ['WDM_ARCHITECTURE'] = 'x64'
476+
477+
driver_bin_path = ChromeDriverManager(driver_version=chrome_version).install()
478+
479+
service = Service(driver_bin_path)
480+
selenium_driver = webdriver.Chrome(options=opts, service=service)
465481
selenium_driver.implicitly_wait(0.5)
466482
CommonUtil.ExecLog(sModuleInfo, "Started Electron App", 1)
467483
Shared_Resources.Set_Shared_Variables("selenium_driver", selenium_driver)

0 commit comments

Comments
 (0)