Created
November 15, 2016 14:07
-
-
Save ujwalp1994/360e63f2a0451a819d166dfba99c0842 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 | |
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities | |
import time | |
from selenium.webdriver.support.ui import WebDriverWait | |
from selenium.webdriver.support import expected_conditions as EC | |
from selenium.webdriver.common.by import By | |
from selenium.webdriver.chrome.options import Options | |
***** Chrome Options to add extensions ********* | |
chop = webdriver.ChromeOptions() | |
chop.add_extension('/Path to your exetension.crx') | |
cc = chop.to_capabilities() | |
extension_var = cc['chromeOptions']['extensions'] | |
******* Creating WebDriver instance ************ | |
desired_cap={ 'browser': 'Chrome', 'browser_version': '47.0', 'os': 'Windows', 'os_version': '7','chromeOptions': {'args':[],'extensions':extension_var}} | |
driver = webdriver.Remote( | |
command_executor='http://<username>:<access_key>@hub.browserstack.com:80/wd/hub', | |
desired_capabilities=desired_cap | |
) | |
************** Code Logic ******* | |
driver.get('http://www.google.com') | |
print driver.title | |
driver.quit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment