我想在我的armv7板上以amazons3(地址:'https://console.aws.amazon.com/iam/home?#security_credential')登錄。我使用的是來自here和selenium2.45.0的phantom2.0.1。在Phantomjs + selenium中啓用cookie
我可以成功地打開網頁,但是當我做填充的用戶名和密碼,網站跳轉到一個錯誤頁面,顯示「請,啓動cookies來繼續」後,「提交」。所以,我不知道如何啓用phantomjs cookies在selenium.In我與phantomjs合適的版本ubuntu12.04,我能成功的我的代碼
部分低於:
def __init__(self,username,password,login_url,width=1151,height=629):
self.username = username
self.password = password
self.login_url = login_url
dcap = dict(DesiredCapabilities.PHANTOMJS)
dcap["phantomjs.page.settings.userAgent"] = ("Mozilla/5.0 (Macintosh; Intel Mac OS X) AppleWebKit/534.34 (KHTML, like Gecko) Phantomjs/2.0.1 Safari/534.34")
self.driver = webdriver.PhantomJS(executable_path='/bin/phantomjs',desired_capabilities=dcap,service_args=['--ssl-protocol=any','--ignore-ssl-errors=true'])
self.driver.set_window_size(width,height)
def _login_system(self):
try:
self.driver.get(self.login_url)
print self.driver.page_source#I can success here
WebDriverWait(self.driver, 30).until(lambda driver : self.driver.find_element_by_id("ap_email")).send_keys(self.username)
WebDriverWait(self.driver, 30).until(lambda driver : self.driver.find_element_by_id("ap_password")).send_keys(self.password)
WebDriverWait(self.driver, 30).until(lambda driver : self.driver.find_element_by_id("signInSubmit-input")).submit()#failed here and showing Please Enable Cookies to Continue
PhantomJS支持cookie,默認情況下它們處於啓用狀態。不知道,爲什麼這是一個問題。也許這個二進制文件不好。 –
@ ArtjomB.Thanks for your answer.I've試圖在我的armv7板和qemu上用rootfs編譯phantomjs,但它一直失敗,我搜索了這個問題,並且有人提到它可能是內存不足。你有什麼編譯建議? make [2]:*** [generated/JSDOMWindow.cpp]錯誤255 make [2]:離開目錄'/ phantomjs/src/qt/qtwebkit/Source/WebCore' make [1]:* ** [子DerivedSources-PRI-make_first有序]錯誤2 化妝[1]:離開目錄'/ phantomjs/SRC/QT/QtWebKit的/來源/ WebCore的」 化妝:*** [子源 - WebCore- WebCore-pro-make_first-ordered]錯誤2 – lulujun21