英文:
WebScraping in Excel using Selenium - problem with readonly attributes
问题
我想在一个网站中移除只读属性。我只能使用Excel VBA与Selenium来实现这个目的。
网页中的代码如下:
<input type="text" name="fchFin" id="fchFin" readonly="" value="2023-05-26" maxlength="10" size="10" onblur="validarFecha(this);">
英文:
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);">
答案1
得分: 0
尝试这个
Dim iput As WebElement, rO As Boolean
Set iput = driver.FindElementByXPath("//*[@name='someName']")
driver.ExecuteScript "arguments[0].removeAttribute('readonly')", iput
rO = iput.Attribute("readonly")
英文:
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")`
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论