seleniumbase / SeleniumBase

📊 Python's all-in-one framework for web crawling, scraping, testing, and reporting. Supports pytest. UC Mode provides stealth. Includes many tools.
https://seleniumbase.io
MIT License
4.46k stars 910 forks source link

Some elements cannot be inputted using the input method #2687

Closed WaterLoran closed 2 months ago

WaterLoran commented 2 months ago

Some elements cannot be inputted using the input method and require the use of action_chain to simulate real keyboard input.

For example, the following element requires input of a verification code, but if it navigates to the first input box and calls input, it will fail. e4831413aeda7a3bdd102b55cf1899f

However, using the following code will succeed, image

May I ask if there are any relevant packaged methods available.

Perhaps you need to modify the type method, image

The URL of the relevant tested website is as follows. Just enter your email and click to see the verification code page https://app.zeitro.com/services/preapp/emailverification?customerid=zeitro&loid=2fbec8de-8f6a-4fd9-8be3-c9743622e2b7

mdmintz commented 2 months ago

There are different input methods in SeleniumBase. self.type(selector, text) is specifically for regular input fields.

Use one of these for the section on that page:

self.send_keys('input[inputmode="decimal"]', " 1234")

self.press_keys('input[inputmode="decimal"]', " 1234")