Selenium says Element is read-only: <input id="L1" class="LoginFormData" name="L1" type="text">

by jakethedog   Last Updated July 13, 2019 01:26 AM

I had this working previously, but something changed and I wanted to move it to a different vm anyway. The page does not appear to have changed. fields are still L1 and P1. There are no popups or whatever.

The error I get is:

selenium.common.exceptions.InvalidElementStateException: Message: Element is read-only: <input id="L1" class="LoginFormData" name="L1" type="text">
  • Debian Stretch
  • Python 2.7.13
  • Selenium v3.141.0
  • Geckdriver v0.24.0

Code:

from pyvirtualdisplay import Display
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
display = Display(visible=0, size=(1024, 768))
display.start()
driver = webdriver.Firefox()
driver.get("https://testsite.org/")
username = driver.find_element_by_name("L1")
username.clear()
username.send_keys("test user")
password = driver.find_element_by_name("P1")
password.clear()
password.send_keys("logmein")
driver.find_element_by_id("login").click()
driver.get("https://testsite.org/Overview.aspx")
driver.save_screenshot('screenie.png')
driver.close()
display.stop()

This is the path and csspath:

//*[@id="L1"]
#L1
html body.BodyHome form#frm center table tbody tr td.PageBody div#divPageDetail.PageDetail table tbody tr td.Blank table tbody tr td.IntroLeft table tbody tr td.Blank div.IntroHeaderLogin table tbody tr td.LoginFormData input#L1.LoginFormData


Related Questions