为什么我不断收到“无法找到元素”

时间:2019-10-16 05:59:12

标签: python selenium google-chrome web-scraping

我是python的新手,下面的代码给我一个错误:“无法找到元素:{“ method”:“ xpath ...”“。我也尝试过find_element_by_id和find_element_by_name,但是没有运气。我仍然收到错误消息,指出找不到元素。这是因为元素在span类中吗?

chrome_path = r"C:\DRIVERS\chromedriver.exe"
driver = webdriver.Chrome(chrome_path)
driver.get("""https://www.dynamiccommunities.com/widgets/generic?cobaltsrc=https%3A%2F%2Fdciug.dynamiccommunities.com%2FLogin.aspx%3FReturnUrl%3D%2FAuthentication%2FHigherLogicLogin.ashx%3FRedirectURL%3Dhttps%3a%2f%2fwww.dynamiccommunities.com%2fhome""")
driver.maximize_window()
driver.implicitly_wait(30)


driver.find_element_by_xpath("""//*[@id="FormContentPlaceHolder_LoginEditForm_UserName"]""").send_keys('test')
driver.find_element_by_xpath("""//*[@id="FormContentPlaceHolder_LoginEditForm_Password"]""").send_keys('***')
``


0 个答案:

没有答案