2013-08-06 53 views
1

我試圖讓這個簡單的代碼到達Internet。我在代理服務器後面,但是我已經設置了我的http_proxy,https_proxy和no_proxy環境變量。爲什麼我的基於Python的Selenium PhantomJS webcrawler不能到達網絡?

Python代碼:

from selenium import webdriver 
driver = webdriver.PhantomJS() 
driver.get('http://www.google.com') 
driver.page_source 

輸出:

u'<html><head><title> Web Authentication Redirect</title><meta http-equiv="Cache-control" content="no-cache"><meta http-equiv="Pragma" content="no-cache"><meta http-equiv="Expires" content="-1"><meta http-equiv="refresh" content="1; URL=https://1.1.1.1/login.html?redirect=www.google.com/"></head><body>\n</body></html>' 

如何解決這個問題的任何想法?

另外,我在Ubuntu 12.04 LTS上。

回答

0

如果它是你登陸一個網頁一個網頁,然後將您重定向(又名,等待問題),那麼你可以嘗試wait.until(ExpectedConditions.titleIs("Google"))

注:這是Java代碼,但它不應該太難轉換了。 waitWebDriverWait

相關問題