2017-09-19 55 views
0

我的python腳本按預期運行,然後我需要添加PIL軟件包,並安裝了Pyscreenshot,PIL和Pillow進行圖像處理。安裝枕頭後無法導入selenium webdriver

安裝這些軟件包後,導入selenium語句變灰,我不能再導入硒。

我卸載了圖像處理的包來恢復設置,但沒有運氣

from selenium import webdriver 
from selenium.common.exceptions import NoSuchElementException 
from selenium.webdriver.support.ui import WebDriverWait 
from selenium.common.exceptions import TimeoutException 
from selenium.webdriver.support import expected_conditions as EC 
from selenium.webdriver.common.by import By 

#import pyscreenshot as ImageGrab 
#from PIL import Image 


BaseUrl = "http://google.com" 
browser.get(BaseUrl) 
browser.implicitly_wait(10) 

注:我有硒和安裝gckodriver和路徑也增加了。

任何幫助將不勝感激。提前致謝。

+0

什麼樣的錯誤你得到 –

回答

0

PIL或Pillow與硒庫沒有任何關係。所以這不應該是問題。

此外,我沒有發現任何瀏覽器的初始化。

browser = webdriver.Firefox() 

下面的代碼對我的作品

from selenium import webdriver 
from selenium.common.exceptions import NoSuchElementException 
from selenium.webdriver.support.ui import WebDriverWait 
from selenium.common.exceptions import TimeoutException 
from selenium.webdriver.support import expected_conditions as EC 
from selenium.webdriver.common.by import By 

BaseUrl = "http://google.com" 
browser = webdriver.Firefox() 
browser.get(BaseUrl) 
browser.implicitly_wait(10) 
+0

Thankss您的回覆,但瀏覽器的初始化是這是工作的罰款真實腳本的一部分。不確定枕頭停止導入後。 –

+0

粘貼錯誤 –