excelvbaweb-scrapingselenium-chromedriverreadonly-attribute

WebScraping in Excel using Selenium - problem with readonly attributes


I would like to remove the readonly attribute in a website. I can only use Excel VBA with Selenium in order to do this.

The code in the webpage is the following:

<input type="text" name="fchFin" id="fchFin" readonly="" value="2023-05-26" maxlength="10" size="10" onblur="validarFecha(this);">

Solution

  • try this

    Dim iput As WebElement, rO As Boolean
    Set iput = driver.FindElementByXPath("//*[@name='someName']")
    driver.ExecuteScript "arguments[0].removeAttribute('readonly')", iput 
    rO = iput.Attribute("readonly")`