我正在尝试使用“find_element_by_xpath”查找元素,但出现“无法定位元素”的错误。
我也尝试过隐式等待,但仍然无法找到该元素。
HTML 文件如下所示:
<div class="actions">
<input type="submit" value="Save" data-action="save">
</div>
<input type="hidden" name=actionId>
我试过下面的代码行:
driver.implicitly_wait(10)
driver.find_element_by_xpath("//input[@type='submit']")
driver.find_element_by_xpath("//class[@name='
actions']/input[@type='submit']"
driver.find_element_by_xpath("//form[@id='form-
submit']/input[@type='submit']")
以上所有尝试都显示错误“没有这样的元素:无法找到元素”
我曾尝试使用“execute_script”来处理隐藏元素,
element = driver.find_element_by_xpath("//input[@type='submit']")
driver.execute_script("arguments[0].click();", element)
这没有给出任何错误,但我不确定它是否单击了正确的按钮,因为新网页正在打开并显示消息“无法访问您正在尝试的页面”。