Answer the question
In order to leave comments, you need to log in
How to fill a form using Selenium?
I'm trying to enter a number using selenium in the phone input field on the bosch.kofemashini.com
website .
I see that selenium selects the field, but for some reason does not enter. In this case, the field is highlighted in red.
Why can't I enter my phone number?
from seleniumwire import webdriver
from time import sleep
from random import choice
phones = ['4951553668', '4950818500', '4954298904']
driver = webdriver.Chrome(
executable_path='chromedriver.exe'
)
url = 'http://bosch.kofemashini.com/'
driver.get(url)
element = driver.find_element_by_class_name('form-control')
element.send_keys(f"{choice(phones)}")
# btn = driver.find_element_by_css_selector('.btn btn-block btn-danger')
# btn.click()
sleep(15)
Answer the question
In order to leave comments, you need to log in
This is:
element = driver.find_element_by_class_name('form-control')
element.send_keys(f"{choice(phones)}")
element = driver.find_element_by_tag_name('input')
element.click()
element.send_keys(choice(phones))
first wait for the element to be ready for interaction (at least sleep(5000))
then click on it.
then send_keys().
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question