How to hide FirefoxDriver (using Selenium) without findElement function error in PhantomDriver(headless browser)?

前端 未结 3 702
Happy的楠姐
Happy的楠姐 2021-01-16 11:09

I try to make hidden FirefoxDriver. According to my research I must use PhantomJSDriver but when I use PhantomJSDriver driver.FindElement statement no longer does not work.<

3条回答
  •  生来不讨喜
    2021-01-16 11:26

    There is no way to hide FirefoxDriver per se. You could run it on a virtual machine and minimize the vm window but that's not practical for most people.

    Let's take a look at your real problem though. It looks like Google is assigning the id of the search box with js to prevent scraping since it's against their terms of service.

    You have a couple options here:

    1) locate the element using the name 'q' since it's named that regardless of phantomjs or firefox.

    2) just go directly to the search results page: https://www.google.com.tr/search?q=edd

提交回复
热议问题