'Simple Selenium project not working properly
I wrote code which open the site in EDGE and sign in to my account.
Then it should fill some inputs and click submit button. My code do it but nothing are saving. It saves like I don't enter anything. But when I fill inputs by myself and click submit it works and save data. Why that happened? Why it happens?
That's my Code
# define group in select option
groups = browser.find_elements(by=By.TAG_NAME, value="select")[0]
for option in groups.find_elements(by=By.TAG_NAME, value="option"):
if option.text == "R4":
option.click()
time.sleep(1)
break
# define date
date = browser.find_elements(by=By.XPATH, value="//input[@type='date']")[0]
date.clear()
browser.execute_script(f"document.querySelector(\"input[type='date']\").value='2022-03-17'")
# define topic name
topic_name = browser.find_elements(by=By.XPATH, value="//input[@type='text']")
topic_name[0].clear()
topic_name[0].send_keys("Topic one")
# give the score to student
student_score = browser.find_elements(by=By.XPATH, value="//input[@type='number']")
for i in range(1, len(student_score)):
student_score[i].clear()
student_score[i].send_keys(7)
# submit
button_submit_one = browser.find_elements(by=By.CLASS_NAME, value="btn-success")
button_submit_one[0].click()

This is the result which I get before click the submit button.
Solution 1:[1]
send_keys() accepts text as an argument. Ideally the line should be:
student_score[i].send_keys("7")
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | undetected Selenium |
