Python:Selenium找不到页面的xpath

Python:Selenium找不到页面的xpath,python,selenium-webdriver,Python,Selenium Webdriver,我正在制作一个小应用程序,为GitHub制作一个新的回购协议。在到达应该插入存储库名称的页面之前,它工作得很好,但是在该页面中,它找不到任何元素XPath 这是正确的定位器:。通过xpath('/*[@id=“repository\u name”]')查找元素。 您可能需要这样的WebDriverWait: 通过xpath WebDriverWait(driver, 10).until(expected_conditions.visibility_of_element_located((By.

我正在制作一个小应用程序,为GitHub制作一个新的回购协议。在到达应该插入存储库名称的页面之前,它工作得很好,但是在该页面中,它找不到任何元素XPath


这是正确的定位器:
。通过xpath('/*[@id=“repository\u name”]')查找元素。

您可能需要这样的
WebDriverWait

通过xpath

WebDriverWait(driver, 10).until(expected_conditions.visibility_of_element_located((By.XPATH, '//*[@id="repository_name"]')))
newProject = driver.find_element_by_xpath('//*[@id="repository_name"]')
newProject.send_keys('qwerty')
按id分类

WebDriverWait(driver, 10).until(expected_conditions.visibility_of_element_located((By.ID, 'repository_name')))
newProject = driver.find_element_by_id('repository_name')
newProject.send_keys('qwerty')
以下内容:

from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions

请同时提供一份。。。为什么不使用GithubAPI而不是Web自动化?示例:我觉得看着它做itAh会很有趣,好吧!:)向我们展示你的代码,我们会让它工作的。我不知道有什么需要寻找的,它基本上打开浏览器(chrome),最大化它,登录到我的github,点击右上角的小图标,点击“你的存储库”,点击新建,现在它在“创建新存储库”页面,现在我有了这行代码,是不起作用的部分,它只是因为某种原因找不到该元素的xpath。。。即使我在前面的步骤中使用了相同的方法…未定义变量by请导入:
from selenium.webdriver.common.by import by
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions