2017-01-06 2 views
0

問題を引き起こします。私は私が作成したリンクのリストを持っていると私はthem.Iを訪問するセレンは、このためにループのために使用されるが、最初のリンクの後に、それは私にこのエラーを与えたい:ここPythonでセレンとのリンクをループできません

ImportError: sys.meta_path is None, Python is likely shutting down 

は私のコード

です
from selenium import webdriver 
import time 

links = ['https://www.youtube.com','https://www.google.com'] 

driver = webdriver.Chrome(R'C:\Users\a1234\Desktop\chromedriver.exe') 

for link in links: 
    driver.get(link) 
    time.sleep(10) 
    driver.close() 

また、私が崇高なテキストを使用しているので、生の文字列にはRを使用しなければならないので間違いではありません。しかし、とにかくおかげで。

答えて

0

は、forループを完了した後に、ブラウザを閉じて

from selenium import webdriver 
import time 

links = ['https://www.youtube.com','https://www.google.com'] 

driver = webdriver.Chrome(R'C:\Users\a1234\Desktop\chromedriver.exe') 

for link in links: 
    driver.get(link) 
    time.sleep(10) 

driver.close() 
関連する問題