Skip to content

Instantly share code, notes, and snippets.

@ujwalp1994
Last active November 15, 2016 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ujwalp1994/c86d7584b9008738a7bb98feec2dc8fa to your computer and use it in GitHub Desktop.
Save ujwalp1994/c86d7584b9008738a7bb98feec2dc8fa to your computer and use it in GitHub Desktop.
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
***** FirefoxProfile to add extensions *********
profile = webdriver.FirefoxProfile()
profile.add_extension('/Path to the extension.xpi')
profile.update_preferences()
desired_cap={ 'browser': 'Firefox', 'browser_version': '47.0', 'os': 'Windows', 'os_version': '7'}
******* Creating WebDriver instance ************
driver = webdriver.Remote(
command_executor='http://<username>:<access_key>@hub.browserstack.com:80/wd/hub',
desired_capabilities=desired_cap, browser_profile=profile
)
************** Code Logic *******
driver.get('http://www.google.com')
driver.quit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment