Skip to content

\n does not trigger “Enter” key in search input with mobile=True #3396

@jmonfron

Description

@jmonfron

When using SeleniumBase with the following code:

with SB(uc=True, mobile=True, proxy=proxy_address, locale="fr") as sb:
    url = "https://google.fr"
    sb.activate_cdp_mode(url)
    sb.sleep(3)
    sb.cdp.mouse_click("button:contains('Tout accepter')")
    sb.sleep(3.5)
    sb.type("input[name='q'], textarea[name='q']", "SeleniumBase GitHub page\n")

The \n character in the .type() method does not trigger the “Enter” key to submit the Google search. Instead, it inserts a newline into the input field, as if the user pressed Shift+Enter.

I also tested the following command:

sb.cdp.press_keys("input[name='q'], textarea[name='q']", keyword + "\n")

However, this also failed to trigger the “Enter” key as expected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    UC Mode / CDP ModeUndetected Chromedriver Mode / CDP Modeworkaround existsYou can reach your destination if you do this...

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions