Python selenium.common.exceptions.ElementNotInteractiableException消息元素不可交互

Python selenium.common.exceptions.ElementNotInteractiableException消息元素不可交互,python,selenium,beautifulsoup,Python,Selenium,Beautifulsoup,以下是链接: "https://btlaesthetics.com/en/find-a-physician" 我使用selenium在位置搜索框中搜索了邮政编码“6292”(如下面的代码所示)。它搜索并显示结果。现在它一个接一个地点击每个诊所(科室)的“显示详细信息”,它这样做了,但我面临的主要问题是,它每次点击每个科室的详细信息时都会刮取第一科室的数据(电话、电子邮件、网站),而不是刮取每个科室自己的数据。 代码如下: from selenium import webdriver from b

以下是链接: "https://btlaesthetics.com/en/find-a-physician"

我使用selenium在位置搜索框中搜索了邮政编码“6292”(如下面的代码所示)。它搜索并显示结果。现在它一个接一个地点击每个诊所(科室)的“显示详细信息”,它这样做了,但我面临的主要问题是,它每次点击每个科室的详细信息时都会刮取第一科室的数据(电话、电子邮件、网站),而不是刮取每个科室自己的数据。 代码如下:

from selenium import webdriver
from bs4 import BeautifulSoup
import time


options = webdriver.ChromeOptions()
options.add_experimental_option('excludeSwitches', ['enable-logging'])
driver = webdriver.Chrome(executable_path='D:\python\chromedriver\chromedriver.exe', options=options)
driver.get("https://btlaesthetics.com/en/find-a-physician")
driver.maximize_window()

element = driver.find_element_by_xpath("//input[@class='inp-text filter-address-input pac-target-input']")
element.send_keys("6292")
element.send_keys(u'\ue007')
element.send_keys(u'\ue007')
element.send_keys(u'\ue007')
element.send_keys(u'\ue007')
element.send_keys(u'\ue007')
element.send_keys(u'\ue007')
element.send_keys(u'\ue007')
element.send_keys(u'\ue007')
element.send_keys(u'\ue007')
element.send_keys(u'\ue007')
element.send_keys(u'\ue007')
element.send_keys(u'\ue007')
time.sleep(3)

html = driver.page_source
soup = BeautifulSoup(html, 'html.parser')

item_provider_near = soup.find_all('div', class_='item-provider')
for each in range(len(item_provider_near)):
    each = "(//a[@class='toggle-more'])[" + str(each+1) + "]"
    driver.find_element_by_xpath(each).click()
    time.sleep(3)
    phone = soup.find('span',class_='provider-phone').text
    email = soup.find('span',class_='provider-email').text
    website = soup.find('span',class_='provider-website').text
    if phone:
        print(phone)
    else:
        pass

    if email:
        print(email)
    else:
        pass

    if website:
        print(website)
    else:
        pass
driver.quit()

最后,在抓取后,它显示错误:selenium.common.exceptions.elementnotinteractiableexception message element not interactiable

请使用此链接:hey@sonulohani,现在它没有显示任何错误,但仍然显示相同的结果,即1节数据不能使用try-except块。如果引发ElementNotInteractiableException异常,则将其传入exception block。不,它现在没有给出错误,但显示了错误的结果,即每个部分的第一部分数据哦,我看到了。。。它仍然用html显示数据,甚至没有点击“显示细节”。谢谢