无法使用python和selenium定位元素

无法使用python和selenium定位元素,python,selenium,web-scraping,Python,Selenium,Web Scraping,我想点击“下一步”的按钮,它的名字是“下一步” 在此页面中 这是我的代码 from selenium import webdriver from selenium.webdriver.firefox.options import Options options = Options() options.add_argument("--headless") browser= webdriver.Firefox(options=options, executable_path=&

我想点击“下一步”的按钮,它的名字是“下一步”
在此页面中

这是我的代码

from selenium import webdriver
from selenium.webdriver.firefox.options import Options
options = Options()
options.add_argument("--headless")
browser= webdriver.Firefox(options=options, executable_path="geckodriver.exe")
browser.get('https://www.tgju.org/profile/price_dollar_rl/history');
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
wait = WebDriverWait(browser,20)
from selenium.webdriver.common.by import By
browser.find_element_by_xpath('//*[@id="DataTables_Table_0_next"]')

我得到了这个错误
找不到元素://*[@id=“DataTables\u Table\u 0\u next”]
但我复制了准确的身份证检查表

谢谢您需要添加等待元素才能出现。在这个页面上,它看起来像是动态加载的

element = WebDriverWait(browser, 10).until(
        EC.presence_of_element_located((By.ID, "DataTables_Table_0_next"))
    )

删除
选项时会发生什么情况?添加参数(“--headless”)
?@DebanjanB它不起作用,因此我们需要在没有
选项的情况下解决问题。首先添加参数(--headless”)
,然后继续执行headless。@它不起作用,并得到相同的错误确切的错误是什么?引发的错误是“TimeoutException”(消息、屏幕、堆栈跟踪)“@DMarti在我的系统中通过localhost刮取它,它工作了。谢谢@DMarti我的答案有帮助吗?”?如果是,则标记为正确。有点不清楚你最后的信息是什么意思。