Note that there are some explanatory texts on larger screens.

plurals
  1. POorg.openqa.selenium.InvalidElementStateException: Element is read-only and so may not be used for actions
    primarykey
    data
    text
    <p>n my page there are lots of drop down boxes and text fields.while testing the page in eclipse IDE its showing the above exception. I am not able to find any solution for this Exception</p> <p>This is my code:</p> <pre><code>public class QuoteNewEntry { private WebDriver driver; private String baseUrl; private boolean acceptNextAlert = true; private StringBuffer verificationErrors = new StringBuffer(); @Before public void setUp() throws Exception { driver = new FirefoxDriver(); baseUrl = "http:///"; driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); } @Test public void testQuoteNewEntry() throws Exception { driver.get(baseUrl + ""); System.out.println("The current Url: "+ driver.getCurrentUrl()); assertEquals("", driver.getTitle()); driver.findElement(By.id("RdbtnLight")).click(); driver.findElement(By.id("txtUserName")).clear(); driver.findElement(By.id("txtUserName")).sendKeys("tom"); driver.findElement(By.id("txtpassword")).clear(); driver.findElement(By.id("txtpassword")).sendKeys("tom"); driver.findElement(By.id("btnSubmit")).click(); assertEquals("", driver.getTitle()); driver.findElement(By.id("btnTrade")).click(); System.out.println("The current Url: "+ driver.getCurrentUrl()); assertEquals("", driver.getTitle()); driver.findElement(By.id("btnQuote")).click(); System.out.println("The current Url: "+ driver.getCurrentUrl()); assertEquals("Quote", driver.getTitle()); driver.findElement(By.id("ContentPlaceHolder1_btnNew")).click(); System.out.println("The current Url: "+ driver.getCurrentUrl()); new Select(driver.findElement(By.id("ContentPlaceHolder1_ddlLineOfBus"))).selectByVisibleText("FCL"); driver.findElement(By.id("ContentPlaceHolder1_txtCaptured")).clear(); driver.findElement(By.id("ContentPlaceHolder1_txtCaptured")).sendKeys("3"); driver.findElement(By.id("ContentPlaceHolder1_rbtn3rdParty")).click(); Thread.sleep(5000); driver.findElement(By.id("ContentPlaceHolder1_txtTotalTransitDays")).clear(); driver.findElement(By.id("ContentPlaceHolder1_txtTotalTransitDays")).sendKeys("10"); driver.findElement(By.id("ContentPlaceHolder1_txtVoyageFrequency")).clear(); driver.findElement(By.id("ContentPlaceHolder1_txtVoyageFrequency")).sendKeys("weekly"); Thread.sleep(5000); driver.findElement(By.id("ContentPlaceHolder1_txtExternal")).clear(); driver.findElement(By.id("ContentPlaceHolder1_txtExternal")).sendKeys("ex"); Thread.sleep(5000); driver.findElement(By.id("ContentPlaceHolder1_btnSave")).click(); try{ driver.findElement(By.xpath("//input[@value = 'alert']")).click(); Thread.sleep(5000); } catch(WebDriverException we){ } } @After public void tearDown() throws Exception { //driver.quit(); String verificationErrorString = verificationErrors.toString(); if (!"".equals(verificationErrorString)) { fail(verificationErrorString); } } private boolean isElementPresent(By by) { try { driver.findElement(by); return true; } catch (NoSuchElementException e) { return false; } } private String closeAlertAndGetItsText() { try { Alert alert = driver.switchTo().alert(); if (acceptNextAlert) { alert.accept(); } else { alert.dismiss(); } return alert.getText(); } finally { acceptNextAlert = true; } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload