操作: 输入密码
代码(带有Python的硒):
driver.find_element(By.XPATH,"//input[@id='passwordClear1']").send_keys("TPtp123#")
源代码:
..input type="text" style="display: block;" autocomplete="OFF" maxlength="20" onclick="if (this.value == 'Password') { this.value = ''; }" onblur="if (this.value == '') { this.value = 'Password'; }" value="Password" name="passwordClear" id="passwordClear1" class="txtbox disblk font13 fleft" onfocus="passwordInput1();" tabindex="1"> <input type="password" style="display: none;" autocomplete="OFF" maxlength="20" value="" id="password1" name="password" class="txtbox disnon fleft" onblur="changeInput1();">
..input type="submit" value="Login" onclick="PDLogTrackAjax();" class="medimum-btn login-btn font14 fleft" style="border:0px; height:36px; margin-left:8px;" tabindex="0"><br clear="all">
错误:
selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable
请帮助我解决此错误。
答案 0 :(得分:0)
您必须使用JavascriptExecutor
。
您可以使用JavascriptExecutor js=(JavascriptExecutor)driver
并在定位器包含ajax元素时执行脚本。