CustomLiveServerTestCase(LiveServerTestCase):
def setUp(self):
self.wd = webdriver.PhantomJS()
self.wd.set_window_size(1280, 720)
super(CustomLiveServerTestCase, self).setUp()
def tearDown(self):
super(CustomLiveServerTestCase, self).tearDown()
self.wd.close()
Tuesday, December 30, 2014
Python / Django / Selenium: Set viewport size (window size)
The default viewport size for PhantomJs is like a phone size width. I found plenty of examples of setting the viewport size of the window for Java, C# and Ruby but not much for Python. It's ridiculously simple. Below is an example basically for my future reminder, but here for your enjoyment. This sets the viewport 1280px wide by 720px high.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment