我没有硒的经验。我尝试了几种方法来点击表单中的提交按钮,但都不起作用。请帮助我解决这个问题。
我发现按钮已启用(is_enabled()
(,但未显示(is_displayed()
(。
我逐一尝试了以下选项。我已经在注释中添加了该代码的连续结果。
z=driver.find_element_by_xpath("//input[@name='commit']")
z.click() #It is showing error, Message: element not interactable
z.send_keys(Keys.ENTER) #It is showing error, Message: element not interactable
driver.execute_script("arguments[0].click();", z) #Shows no error, but nothing happens
z.submit() #Shows no error, but nothing happens
我试过driver.implicitly_wait(20)
,但没有成功。我也尝试了直到选项,但它给出了错误。
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//input[@name='commit']"))).submit() #This raises TimeoutException
HTML代码遵循
input type="submit"name="commit"value="Calculate"class="btn-btn-primary"autocomplete="off"数据禁用with="Calculation">
网页链接为:https://proteins.plus/ktypdbdd9c38b7-1738-45fd-a0fb-90ea86f5dd8b我点击了";DoGSiteScorer结合位点检测";,那么";DoGSiteScorer";按钮现在我想舔一下";计算";按钮不工作。
那我该怎么做呢?
问题是:
z=driver.find_element_by_xpath("//input[@name='commit']")
返回该页面上的11个元素,并且不能对11个元素调用click()
。
假设你想点击红色的"计算"按钮,试试这个:
z = driver.find_element_by_xpath("(//input[@name='commit'])[2]")
z.click()