Home > Enterprise >  Switch between tabs - Selenium - Lambda
Switch between tabs - Selenium - Lambda

Time:11-16

Need your guidence please I try to create a Lambda function that run Selenium.

Created the nessecery layers (all the packages and etc) and upload them to the Lambda. Write the code, locally and on the lambda.

The problem is that: In my scripts I query web page that has button that open a new tab, and when I run the code in a headless mode using Lambda, I cant switch between the tabs. Anyone Encounter this issue?

The version are:

  1. headless-chromium-v1.0.0.55
  2. chrome-driverV2.43

Appriciate any help. Thanks!

explain in the question

CodePudding user response:

just loop through the tabs, and use the code below

read more here

   # Store the ID of the original window
    original_window = driver.current_window_handle
    
    # Loop through until we find a new window handle
    for window_handle in driver.window_handles:
        if window_handle != original_window:
            driver.switch_to.window(window_handle)
            break
  • Related