谷歌地图 - 加载时出错

时间:2017-08-18 16:23:24

标签: javascript google-maps google-maps-api-3

在我的网站上,当我进行设计时,谷歌地图已经完成了。托管后显示错误:

  

糟糕!出了点问题“

我试图找到解决方案,发现缺少API密钥。我使用个人Gmail帐户创建了一个密钥,并添加到下面的页脚位置。

<div id="google-map" class="wow fadeIn" data-latitude="13.0938666" data-longitude="80.202357" data-wow-duration="1000ms" data-wow-delay="400ms"></div>

但在那之后它也没有用。下面是我在HTML和js中的谷歌地图脚本。

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
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.common.exceptions import TimeoutException

chromeOptions = webdriver.ChromeOptions()
prefs = {"download.default_directory" : "Location"}
chromeOptions.add_experimental_option("prefs",prefs)
driver=webdriver.Chrome("\\chromedriver.exe",chrome_options=chromeOptions)
driver.implicitly_wait(30)
driver.maximize_window()
driver.implicitly_wait(100)
driver.get("URL") 
username=driver.find_element_by_id("user")
username.clear()
username.send_keys("mmnba")
password=driver.find_element_by_id("pw")
password.clear()
password.send_keys("dfsdf")
driver.implicitly_wait(20)
login=driver.find_element_by_id("loginButton")
login.click()
driver.implicitly_wait(20)
rollup=driver.find_element_by_xpath("")
rollup.click()
driver.switch_to.frame(0)
link=driver.find_element_by_xpath("//td[@id="""")
link.click()
driver.implicitly_wait(20)
pageList=driver.find_elements_by_xpath("")

def candidate():
    global k,page_num,driver
    for j in range(0,20):
        try: 
            driver.implicitly_wait(50)   
            employeeList=driver.find_elements_by_xpath("")
            employeeList[j].click()
            driver.switch_to_default_content()
            driver.implicitly_wait(50)
            driver.switch_to.frame("detail")
            wait = WebDriverWait(driver,20)
            resume = 
 wait.until(EC.presence_of_element_located((By.XPATH,"")))
            driver.implicitly_wait(50)
            resume.click()
            download = 
 wait.until(EC.presence_of_element_located((By.XPATH,'//a[@title="Download 
 Resume"]')))

            driver.implicitly_wait(50)
            download.click()
            driver.implicitly_wait(50)
            driver.switch_to.frame("RTFVIEWER_MS")
            msword = 
wait.until(EC.presence_of_element_located((By.XPATH,"")))
            driver.implicitly_wait(50)            
            msword.click()
        except TimeoutException as ex1:
            print("Exception has been thrown"+str(ex1))
            print(j)
            driver.switch_to_default_content()
            driver.switch_to.frame(0)
            continue

      # Code for moving from one page to the next
k=0
page_num=0    
candidate()
pageList=driver.find_elements_by_xpath("")

for i in range(0,10):
    driver.implicitly_wait(50)    

pageList=driver.find_elements_by_xpath("")
    if i !=9:
        page_num=i
print("page number is "+str(page_num))
pageList[i].click()    
candidate()
if i==9:
    k=1
    pageList=driver.find_elements_by_xpath("")
    i=1
    page_num=i
    while i<12:    
        driver.implicitly_wait(50)
        pageList=driver.find_elements_by_xpath("")
        if i ==10:
            pageList[i].click()
            candidate()
            k=k+1
            print("k is "+str(k))
            i=1
            page_num=i
        else:   
            page_num=i
            print("page number is "+str(page_num))
            pageList[i].click()
            candidate()
            i=i+1

#EDIT : Adding Traceback

Traceback (most recent call last):

File "<ipython-input-7-f663f73d040e>", line 1, in <module>
runfile('D:/automate_v6.py', wdir='D:/')

File "C:\Users\Vishnu\Anaconda2\lib\site-
packages\spyderlib\widgets\externalshell\sitecustomize.py", line 714, in 
runfile
execfile(filename, namespace)

File "C:\Users\Vishnu\Anaconda2\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 74, in execfile
exec(compile(scripttext, filename, 'exec'), glob, loc)

 File "D:/automate_v6.py", line 214, in <module>
 candidate()

File "D:/automate_v6.py", line 177, in candidate
driver.switch_to_default_content()

File "C:\Users\Vishnu\Anaconda2\lib\site-packages\selenium-2.53.1-py2.7.egg\selenium\webdriver\remote\webdriver.py", line 575, in 
switch_to_default_content
self._switch_to.default_content()

File "C:\Users\Vishnu\Anaconda2\lib\site-packages\selenium-2.53.1-py2.7.egg\selenium\webdriver\remote\switch_to.py", line 52, in default_content
self._driver.execute(Command.SWITCH_TO_FRAME, {'id': None})

File "C:\Users\Vishnu\Anaconda2\lib\site-packages\selenium-2.53.1-py2.7.egg\selenium\webdriver\remote\webdriver.py", line 233, in execute
self.error_handler.check_response(response)

File "C:\Users\Vishnu\Anaconda2\lib\site-packages\selenium-2.53.1-py2.7.egg\selenium\webdriver\remote\errorhandler.py", line 194, in check_response
raise exception_class(message, screen, stacktrace)

TimeoutException: timeout
(Session info: chrome=60.0.3112.101)
(Driver info: chromedriver=2.31.488763 
(092de99f48a300323ecf8c2a4e2e7cab51de5ba8),platform=Windows NT 10.0.14393 
x86_64)
{{1}}

0 个答案:

没有答案