2

Please check this image : https://i.stack.imgur.com/ZueOm.jpg You can see the window screen width is 1280, but the firefox only can get 1152 to display. I'm using selenim with python.

I can use set_window_size() to make firefox has the size of (1280x720) but some how the window still get cropped (black border at right and bottom like in the screenshot).

#!/usr/bin/env python
from selenium.webdriver.common.keys import Keys
from selenium import webdriver
from pyvirtualdisplay import Display
import sys, time
import signal


width = 1280
height = 720

display = Display(visible=0, size=(width, height))
display.start()
browser = webdriver.Firefox()

browser.get("https://google.com")
browser.find_element_by_xpath('/html/body').send_keys(Keys.F11)
browser.maximize_window()

while True:
    time.sleep( 5 )
    print "loop"
Deepak Rai
  • 2,163
  • 3
  • 21
  • 36
boygiandi
  • 630
  • 10
  • 20

1 Answers1

0

browser.maximize_window()

remove maximize , it will reset the winow size

PDHide
  • 18,113
  • 2
  • 31
  • 46