1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Python] mouse over and click not working in remote webdriver in docker, but works in local...

Discussão em 'Python' iniciado por Stack, Outubro 8, 2024.

  1. Stack

    Stack Membro Participativo

    this is how I connect to the remote webdriver, which is running in docker using offical image selenium/standalone-chrome:128.0

    ops = webdriver.ChromeOptions()
    ops.add_argument("download.default_directory={}".format(os.getcwd()))
    ops.add_argument("--headless=new")
    ops.add_argument('--start-maximized')
    browser = webdriver.Remote('http://ip:4444', options=ops)


    this is the automation code of hovering over an element:

    el = driver.find_element(*location)
    actions = ActionChains(driver)
    actions.move_to_element(el).perform()


    and click on the same element:

    wait = WebDriverWait(driver, time_out, poll_frequency)
    wait.until(ec.element_to_be_clickable(location), 'time out')
    driver.find_element(*location).click()


    Both code snips above work normally on my local Chrome with the same options, but not working in remote webdriver.
    I also take screen shot to check the effect, I can see the hover and click effect in local env, but not in remote.


    After some test, I found out this page is not clickable or responsive to any operation, it seems like the page cannot be loaded completely in remote webdriver. This page is the second window/tab opened in my code, I only have 2 tabs.

    Is there some difference between remote webdriver and local browser which would affect the page loading?

    Continue reading...

Compartilhe esta Página