Remove readonly attributes in Selenium WebDriver

前端 未结 3 1628
北恋
北恋 2021-01-13 15:21

I need to edit some readonly fields with Selenium WebDriver in Java. As Selenium won\'t let me even find this fields I searched for solutions and found that the

3条回答
  •  梦毁少年i
    2021-01-13 15:46

    WebElement elementName = driver.findElement(By.xpath("//div[@arid='7']//input[@id='arid7']"));
    ((JavascriptExecutor) driver).executeScript("arguments[0].removeAttribute('readonly','readonly')", elementName);
    

    This worked for me

提交回复
热议问题