当前正在尝试从此url检索数据
我正在尝试检索以下内容:单位名称、现场街道1、2、现场Ciy、省/州、代码、设施类别、已完成。我已经成功地这样做了,但代码似乎出现在一行中。 例如:
@ The Trax Public House 304 Westgrove Drive Spruce Grove AB T7X 4P9 Food - General 1
我的预期输出是为了收集特定属性:单元名称:@the Trax Public House,Site Street 1:304 Westgrove Drive,等等
这是我的密码
start_time = time.time()
driver = webdriver.Chrome(ChromeDriverManager().install())
driver.implicitly_wait(5)
URL = 'https://ephisahs.microsoftcrmportals.com/disclaimer/restaurantinspections/edmonton-facilities/'
driver.get(URL)
restaurant_names = []
search = driver.find_elements_by_xpath("//tr[@data-name]")
for restaurants in search:
print(restaurants.text)
time.sleep(5)
driver.close()
另外:我想在所有可能的页面中循环,但我注意到URL中似乎没有页码。如何循环浏览此网站上所有可能的页面
您应该等待,不仅要找到head元素,还要找到它们的子元素
我的输出:
多页更新:
我试着翻阅了几页,发现第二页和第三页上没有找到一些定位器。因此,我正在更新代码并添加多页方法
相关问题 更多 >
编程相关推荐