Answer the question
In order to leave comments, you need to log in
The parser does not work for the customer, what should I do?
Good afternoon, I made a link parser for google maps, but it does not work for the customer. In the video, you can roughly understand how it should work - it parses links from the left block. This video was sent by the customer, I have parse links and are inserted into a text document, but the customer does not have it. Thank you so much for your help
Program code:
from selenium import webdriver
from time import sleep
from selenium.webdriver.chrome.options import Options
driver = webdriver.Chrome()
driver.get('https://www.google.ru/maps/')
Search = input('Search: ')
driver.find_element_by_xpath("//input[@id='searchboxinput']").send_keys(Search + '\n')
sleep(5)
while True:
try:
driver.find_element_by_xpath("//div[@class='section-result-text-content']").click()
break
except:
sleep(0.1)
num = -1
number = 1
list = []
sleep(5)
while True:
#print(driver.find_element_by_xpath("//div[@class='section-layout section-layout-root'][1]/div/div/div/div/div/div").get_attribute('class'))
#driver.find_element_by_xpath("//div[@class='section-layout section-layout-root'][1]/div/div/div/div/div/div").click()
while True:
try:
a = driver.find_elements_by_xpath("//div[@class='section-carousel-item-container'][1]/div[" + str(number) + "]")
break
except:
sleep(0.1)
number = 1 + number
for i in a:
num = num + 1
list.append(i.get_attribute('aria-label'))
click = 0
while True:
try:
#print(driver.find_element_by_xpath("//div[@aria-label='" + str(list[num]) + "'][1]/div[2]"))
driver.find_element_by_xpath("//div[@aria-label='" + str(list[num]) + "'][1]/div[2]").click()
#driver.find_element_by_xpath("//div[@class='rLwmCGCu6mP__image-container']").click()
break
except:
sleep(0.1)
click = click + 1
sleep(3)
links = 0
file = open('Map_links.txt', 'a')
while links != 1:
try:
file.write(driver.find_element_by_xpath("//button[@data-tooltip='Open website']").get_attribute('aria-label') + '\n')
print(driver.find_element_by_xpath("//button[@data-tooltip='Open website']").get_attribute('aria-label'))
break
except:
sleep(1)
links = 1 +links
Answer the question
In order to leave comments, you need to log in
why not use
driver = webdriver.Chrome()
this instead
river = webdriver.Chrome(chrome_options=options, executable_path=ChromeDriverManager().install())
from webdriver_manager.chrome import ChromeDriverManager
Maybe the driver is not compatible with the browser?
Your driver version
chromedriver_versiondoes not match the customer's browser version.
see everything that differs on the customer's machine and on yours. there may be 100500 reasons. especially considering that selenium uses different configs for you and the customer. For example, different regional settings, you are not logged in, etc.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question