Created
September 7, 2018 01:25
-
-
Save t0mst0ne/f4f2d4f8bad49f585c59e5ac5353b5f7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from selenium import webdriver | |
from selenium.webdriver.common.keys import Keys | |
service = webdriver.chrome.service.Service('/usr/bin/chromedriver') | |
service.start() | |
options = webdriver.ChromeOptions() | |
options.add_argument('--headless') | |
options = options.to_capabilities() | |
driver = webdriver.Remote(service.service_url, options) | |
driver.get('https://google.com') | |
# Locate the search box element | |
search_box = driver.find_element_by_name('q') | |
import time | |
time.sleep(5) | |
#type in our search query into the search box | |
search_box.send_keys('seleniumhq' + Keys.RETURN) | |
time.sleep(1) | |
print(driver.title) | |
driver.quit() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment