Python + Selenium + PhantomJS => Problems loading and rendering pages with local development server -


i'm saving screenshot when page loaded. if test production, works ok (the page rendered correctly). but, if test local development server, page isn't rendered correctly when check screenshot. some elements (html, images) missing.

the problems phantomjs. if use firefox, works ok. need 'headless', because it's requirement.

i'm using python 2.7.6 + selenium 2.45.0 + phantomjs 1.9.8 (os x yosemite 10.10).

code:

import unittest import time  selenium import webdriver  class test(unittest.testcase):      headless = 1     development = 1      def setup(self):          if self.headless:              self.driver = webdriver.phantomjs()              self.driver.set_window_size(1400, 1200)          else:              self.driver = webdriver.firefox()              self.driver.maximize_window()          self.driver.implicitly_wait(100)          url = 'http'         if self.development:             url += '://development.localhost.lan:3000/login'         else:             url += 's://production_web.com/login'          self.driver.get(url)         time.sleep(10)         self.driver.save_screenshot('login.png')      def teardown(self):         print 'teardown'      def test_import(self):         print 'test_import'  if __name__ == '__main__':     suite = unittest.testloader().loadtestsfromtestcase(test)     unittest.texttestrunner(verbosity=2).run(suite) 

also, i've tested following, no results:

  • service_args=['--local-to-remote-url-access=true']
  • service_args=['--ignore-ssl-errors=true'] : (production https)
  • set user_agent
  • enable/disable cookies
  • activate localtoremoteurlaccessenabled

please, give me advice? in advance!


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -