Jan-14-2018, 05:08 AM
Looking for anyone clever enough to figure this one out for me.
With python 3 I am writing a script that uses Selenium to open googlemaps enter a
site address and then take a screenshot (although pdf would be better) and close the browswer.
Ive gotten everything to work except when I enter the address google has a flyout side panel that blocks half of the
picture and I need it to go away.
I've tracked the xpath to be //*[@id="pane"]/div/div[4]/button
but when i run the script the best error i get is that the element is not visible.
With python 3 I am writing a script that uses Selenium to open googlemaps enter a
site address and then take a screenshot (although pdf would be better) and close the browswer.
Ive gotten everything to work except when I enter the address google has a flyout side panel that blocks half of the
picture and I need it to go away.
I've tracked the xpath to be //*[@id="pane"]/div/div[4]/button
but when i run the script the best error i get is that the element is not visible.
def googlemaps(): from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.common.keys import Keys import time ProjectAddress = input("What is the project Address") browser = webdriver.Chrome() browser.get(('https://www.google.com/maps')) browser.maximize_window() # fill in username and hit the next button website = browser.find_element_by_name("q") website.send_keys(ProjectAddress) website.send_keys(Keys.RETURN) browser.find_element_by_xpath('//*[@id="pane"]/div/div[4]/button').click() time.sleep(5) browser.save_screenshot('SitePlan.png') browser.quit() googlemaps()
Error:Traceback (most recent call last):
File "C:/Users/Barnett Chenault/Desktop/AVA/test - googlesiteplan.py", line 26, in <module>
googlemaps()
File "C:/Users/Barnett Chenault/Desktop/AVA/test - googlesiteplan.py", line 21, in googlemaps
browser.find_element_by_xpath('//*[@id="pane"]/div/div[4]/button').click()
File "C:\Users\Barnett Chenault\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\remote\webelement.py", line 80, in click
self._execute(Command.CLICK_ELEMENT)
File "C:\Users\Barnett Chenault\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\remote\webelement.py", line 628, in _execute
return self._parent.execute(command, params)
File "C:\Users\Barnett Chenault\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 312, in execute
self.error_handler.check_response(response)
File "C:\Users\Barnett Chenault\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 237, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.ElementNotVisibleException: Message: element not visible
(Session info: chrome=63.0.3239.132)
(Driver info: chromedriver=2.34.522940 (1a76f96f66e3ca7b8e57d503b4dd3bccfba87af1),platform=Windows NT 10.0.16299 x86_64)