1

I followed setting up chrome requirements for selenium.webdriver.Chrome, and I used the following code Running webdriver chrome with Selenium:

import os
from selenium import webdriver
from pyvirtualdisplay import Display

display = Display(visible=0, size=(800, 600))
display.start()
driver = webdriver.Chrome()
driver.get("http://www.google.com")
print driver.page_source.encode('utf-8')

I was very surprised to see that the code works, but no browser pops up. I would think this is almost impossible to develop, as I can't see what I'm doing right/wrong. How do I use selenium to actually see a functional Chrome driver (python)? Thank you

ANSWER:

set visible to 1, install emulator:

sudo apt-get install xvfb xserver-xephyr

display = Display(visible=1, size=(800, 600))
Community
  • 1
  • 1
codyc4321
  • 8,012
  • 21
  • 75
  • 152

1 Answers1

1

In java we add these two lines for executing code in chrome

System.setProperty("webdriver.chrome.driver", "/path/to/chromedriver"); WebDriver driver = new ChromeDriver();

not sure if there something similar for python as well!

Ajay
  • 157
  • 4
  • 14