How can I use Selenium in the background?

0 votes
I'm currently working on Selenium and I use chrome driver, but when I run the test scripts, it opens a window. Is there any way that it can access the internet without the window popup?

The code is:

from selenium import webdriver
from selenium.webdriver.common.keys import Keys

driver = webdriver.Chrome()

driver.get("https://www.edureka.co/community")
elem = driver.find_element_by_name("account")
elem.send_keys("Username")
elem2 = driver.find_element_by_name("pass")
elem2.send_keys("Password")
elem.send_keys(Keys.RETURN)

driver.quit()

Here all I'll doing is put in a username and password, but I want to do this without the browser popup if it's possible.

Thanks in advance!
Jul 16 in Selenium by Vaishnavi
• 1,120 points
34 views

1 answer to this question.

0 votes

Hey there!

I would suggest you try using a headless PhantomJs GhostDriver, this is something new and this is the native Selenium Webdriver way of doing it.

You can download PhantomJs executables from http://phantomjs.org/download.html.

driver = webdriver.PhantomJS("./phantomjs") # path to phantomjs binary
driver.get("https://ps.rsd.edu/public/")

elem = driver.find_element_by_name("account")
elem.send_keys("Username")
elem2 = driver.find_element_by_name("pw")
elem2.send_keys("Password")
elem.send_keys(Keys.RETURN)

driver.quit()

Hope this helps:)

answered Jul 22 by anonymous

Related Questions In Selenium

+2 votes
2 answers

How can I press ENTER key with the execute_script in selenium python?

The below code containing Keys.ENTER might just ...READ MORE

answered Mar 27, 2018 in Selenium by nsv999
• 5,050 points
5,697 views
0 votes
1 answer

How can I download the *.jar file from http:// seleniumhq.org using selenium WebDriver?

For Selenium Standalone Server use this: profile.setPreference("browser.helperApps.neverAsk.saveToDisk", "application/java-archive"); and ...READ MORE

answered Apr 9, 2018 in Selenium by Martin
• 4,220 points
405 views
0 votes
1 answer

How do i change the location where my file gets downloaded in Selenium Webdriver and firefox driver?

There are a couple of errors there. ...READ MORE

answered Apr 12, 2018 in Selenium by nsv999
• 5,050 points
1,391 views
0 votes
1 answer

How can I Install Selenium IDE in Firefox

Selenium IDE works with all Firefox versions, ...READ MORE

answered Apr 13, 2018 in Selenium by Meci Matt
• 9,400 points
86 views
0 votes
1 answer

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,050 points
406 views
0 votes
1 answer
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,130 points
762 views
0 votes
1 answer

How to use such xpath to find web elements

It's much simpler to use: #MyDiv123 > div.super or ...READ MORE

answered Jun 14, 2018 in Selenium by Samarpit
• 5,130 points
402 views
0 votes
1 answer
0 votes
1 answer

How can I clear the text in a text box using Selenium WebDriver?

Hello Akriti, you can clear the text ...READ MORE

answered May 29 in Selenium by Anvi
• 11,690 points
135 views