Python selenium.webdriver.common.desired_capabilities.DesiredCapabilities.FIREFOX Examples
The following are 13
code examples of selenium.webdriver.common.desired_capabilities.DesiredCapabilities.FIREFOX().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
selenium.webdriver.common.desired_capabilities.DesiredCapabilities
, or try the search function
.
Example #1
Source File: DriverFactory.py From qxf2-page-object-model with MIT License | 10 votes |
def run_sauce_lab(self,os_name,os_version,browser,browser_version): "Run the test in sauce labs when remote flag is 'Y'" #Get the sauce labs credentials from sauce.credentials file USERNAME = remote_credentials.USERNAME PASSWORD = remote_credentials.ACCESS_KEY if browser.lower() == 'ff' or browser.lower() == 'firefox': desired_capabilities = DesiredCapabilities.FIREFOX elif browser.lower() == 'ie': desired_capabilities = DesiredCapabilities.INTERNETEXPLORER elif browser.lower() == 'chrome': desired_capabilities = DesiredCapabilities.CHROME elif browser.lower() == 'opera': desired_capabilities = DesiredCapabilities.OPERA elif browser.lower() == 'safari': desired_capabilities = DesiredCapabilities.SAFARI desired_capabilities['version'] = browser_version desired_capabilities['platform'] = os_name + ' '+os_version return webdriver.Remote(command_executor="http://%s:%s@ondemand.saucelabs.com:80/wd/hub"%(USERNAME,PASSWORD), desired_capabilities= desired_capabilities)
Example #2
Source File: DriverFactory.py From makemework with MIT License | 8 votes |
def run_browserstack(self,os_name,os_version,browser,browser_version,remote_project_name,remote_build_name): "Run the test in browser stack when remote flag is 'Y'" #Get the browser stack credentials from browser stack credentials file USERNAME = remote_credentials.USERNAME PASSWORD = remote_credentials.ACCESS_KEY if browser.lower() == 'ff' or browser.lower() == 'firefox': desired_capabilities = DesiredCapabilities.FIREFOX elif browser.lower() == 'ie': desired_capabilities = DesiredCapabilities.INTERNETEXPLORER elif browser.lower() == 'chrome': desired_capabilities = DesiredCapabilities.CHROME elif browser.lower() == 'opera': desired_capabilities = DesiredCapabilities.OPERA elif browser.lower() == 'safari': desired_capabilities = DesiredCapabilities.SAFARI desired_capabilities['os'] = os_name desired_capabilities['os_version'] = os_version desired_capabilities['browser_version'] = browser_version if remote_project_name is not None: desired_capabilities['project'] = remote_project_name if remote_build_name is not None: desired_capabilities['build'] = remote_build_name+"_"+str(datetime.now().strftime("%c")) return webdriver.Remote(RemoteConnection("http://%s:%s@hub-cloud.browserstack.com/wd/hub"%(USERNAME,PASSWORD),resolve_ip= False), desired_capabilities=desired_capabilities)
Example #3
Source File: DriverFactory.py From makemework with MIT License | 8 votes |
def run_sauce_lab(self,os_name,os_version,browser,browser_version): "Run the test in sauce labs when remote flag is 'Y'" #Get the sauce labs credentials from sauce.credentials file USERNAME = remote_credentials.USERNAME PASSWORD = remote_credentials.ACCESS_KEY if browser.lower() == 'ff' or browser.lower() == 'firefox': desired_capabilities = DesiredCapabilities.FIREFOX elif browser.lower() == 'ie': desired_capabilities = DesiredCapabilities.INTERNETEXPLORER elif browser.lower() == 'chrome': desired_capabilities = DesiredCapabilities.CHROME elif browser.lower() == 'opera': desired_capabilities = DesiredCapabilities.OPERA elif browser.lower() == 'safari': desired_capabilities = DesiredCapabilities.SAFARI desired_capabilities['version'] = browser_version desired_capabilities['platform'] = os_name + ' '+os_version return webdriver.Remote(command_executor="http://%s:%s@ondemand.saucelabs.com:80/wd/hub"%(USERNAME,PASSWORD), desired_capabilities= desired_capabilities)
Example #4
Source File: DriverFactory.py From qxf2-page-object-model with MIT License | 8 votes |
def run_browserstack(self,os_name,os_version,browser,browser_version,remote_project_name,remote_build_name): "Run the test in browser stack when remote flag is 'Y'" #Get the browser stack credentials from browser stack credentials file USERNAME = remote_credentials.USERNAME PASSWORD = remote_credentials.ACCESS_KEY if browser.lower() == 'ff' or browser.lower() == 'firefox': desired_capabilities = DesiredCapabilities.FIREFOX elif browser.lower() == 'ie': desired_capabilities = DesiredCapabilities.INTERNETEXPLORER elif browser.lower() == 'chrome': desired_capabilities = DesiredCapabilities.CHROME elif browser.lower() == 'opera': desired_capabilities = DesiredCapabilities.OPERA elif browser.lower() == 'safari': desired_capabilities = DesiredCapabilities.SAFARI desired_capabilities['os'] = os_name desired_capabilities['os_version'] = os_version desired_capabilities['browser_version'] = browser_version if remote_project_name is not None: desired_capabilities['project'] = remote_project_name if remote_build_name is not None: desired_capabilities['build'] = remote_build_name+"_"+str(datetime.now().strftime("%c")) return webdriver.Remote(RemoteConnection("http://%s:%s@hub-cloud.browserstack.com/wd/hub"%(USERNAME,PASSWORD),resolve_ip= False), desired_capabilities=desired_capabilities)
Example #5
Source File: browser.py From browsertrix with MIT License | 5 votes |
def _init_caps(self): caps = DesiredCapabilities.FIREFOX return caps
Example #6
Source File: SeleniumTester.py From civet with Apache License 2.0 | 5 votes |
def create_firefox_driver(cls): """ Instructions to get this working: https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/WebDriver Driver can be found here: https://github.com/mozilla/geckodriver/releases Important: After downloading the driver, rename it to 'wires' and put it in your path and chmod 755 """ from selenium.webdriver.common.desired_capabilities import DesiredCapabilities cap = DesiredCapabilities.FIREFOX cap['marionette'] = True driver = webdriver.Firefox(capabilities=cap) driver.implicitly_wait(2) return driver
Example #7
Source File: webdriver.py From expressvpn_leak_testing with MIT License | 5 votes |
def driver(self, browser): self._start_server() command_executor = 'http://127.0.0.1:4444/wd/hub' if browser == 'firefox': return webdriver.Remote(command_executor=command_executor, desired_capabilities=DesiredCapabilities.FIREFOX) if browser == 'chrome': return webdriver.Remote(command_executor=command_executor, desired_capabilities=DesiredCapabilities.CHROME) if browser == 'phantom': return webdriver.PhantomJS() raise XVEx("{} is not supported on {}".format(browser, self._device.os_name()))
Example #8
Source File: SeleniumDrivers.py From AutoTriageBot with BSD 3-Clause "New" or "Revised" License | 5 votes |
def __init__(self): try: self.driver = webdriver.Remote(command_executor='http://firefox:4444/wd/hub', desired_capabilities=DesiredCapabilities.FIREFOX) except URLError as e: print("Failed to connect!") raise e
Example #9
Source File: driver.py From capybara.py with MIT License | 5 votes |
def browser(self): capabilities = self._desired_capabilities if self._firefox: capabilities = (capabilities or DesiredCapabilities.FIREFOX).copy() # Auto-accept unload alerts triggered by navigating away. if capabilities.get("marionette"): capabilities["unhandledPromptBehavior"] = "dismiss" else: capabilities["unexpectedAlertBehaviour"] = "ignore" browser = get_browser(self._browser_name, capabilities=capabilities, **self._options) atexit.register(browser.quit) return browser
Example #10
Source File: seleniumdriver.py From lf2gym with MIT License | 5 votes |
def get(driverType, localDriver=True, headless=False, path='.'): driverType = str(driverType) if driverType == 'PhantomJS': # phantomjs_options.add_argument("--disable-web-security") if localDriver: source = get_source(driverType, path) driver = webdriver.PhantomJS(executable_path=source, service_log_path=join(path, 'phantomjs.log'), service_args=["--remote-debugger-port=9000", "--web-security=false"]) # driver = webdriver.PhantomJS(executable_path=source, service_args=["--remote-debugger-port=9000", "--web-security=false"]) else: driver = webdriver.PhantomJS(service_log_path=join(path, 'phantomjs.log'), service_args=["--remote-debugger-port=9000", "--web-security=false"]) # driver = webdriver.PhantomJS(service_args=["--remote-debugger-port=9000", "--web-security=false"]) elif driverType == 'Chrome': desired = DesiredCapabilities.CHROME desired['loggingPrefs'] = {'browser': 'ALL'} chrome_options = Options() chrome_options.add_argument("--start-maximized") chrome_options.add_argument("--disable-infobars") chrome_options.add_argument("--disable-web-security") # chrome_options.add_argument("--window-size=800,600") if headless: chrome_options.add_argument("--headless") # will not show the Chrome browser window if localDriver: source = get_source(driverType, path) driver = webdriver.Chrome(executable_path=source, service_log_path=join(path, 'chromedriver.log'), desired_capabilities=desired, chrome_options=chrome_options) else: driver = webdriver.Chrome(service_log_path=join(path, 'chromedriver.log'), desired_capabilities=desired, chrome_options=chrome_options) elif driverType == 'Firefox': # desired = DesiredCapabilities.FIREFOX # desired['loggingPrefs'] = {'browser': 'ALL'} firefox_options = Options() firefox_options.add_argument("--start-maximized") firefox_options.add_argument("--disable-infobars") if localDriver: source = get_source(driverType, path) driver = webdriver.Firefox(executable_path=source, service_log_path=join(path, 'geckodriver.log'), firefox_options=firefox_options) else: driver = webdriver.Firefox(service_log_path=join(path, 'geckodriver.log'), firefox_options=firefox_options) return driver
Example #11
Source File: ReelPhish.py From ReelPhish with GNU General Public License v3.0 | 5 votes |
def select_browser(browser_selection): """ Implements operating system checking to determine appropriate browser support Raises exception when unsupported operating system or browser is found Currently supported operating systems and browsers: * Windows: Internet Explorer (IE), Firefox (FF), Chrome * Linux: Firefox (FF), Chrome Returns browser object corresponding to selection choice (browser_selection) """ if sys.platform == "win32": current_path = sys.path[0] if browser_selection == "IE": ie_path = current_path + "\\IEDriver.exe" return webdriver.Ie(ie_path) elif browser_selection == "Chrome": chrome_path = current_path + "\\ChromeDriver.exe" return webdriver.Chrome(chrome_path) # Firefox selenium implementation requires gecko executable to be in PATH elif browser_selection == "FF": firefox_driver_path = current_path + "\\FFDriver.exe" firefox_capabilities = DesiredCapabilities.FIREFOX firefox_capabilities['marionette'] = True return webdriver.Firefox(capabilities=firefox_capabilities, executable_path=firefox_driver_path) else: raise Exception("Invalid Windows browser selection (IE, Chrome, and FF supported)") elif sys.platform == "linux" or sys.platform == "linux2": current_path = os.path.dirname(os.path.abspath(__file__)) if browser_selection == "FF": firefox_driver_path = current_path + "/FFDriver.bin" firefox_capabilities = DesiredCapabilities.FIREFOX firefox_capabilities['marionette'] = True firefox_capabilities['executable_path'] = firefox_driver_path return webdriver.Firefox(capabilities=firefox_capabilities) elif browser_selection == "Chrome": chrome_path = current_path + "/ChromeDriver.bin" return webdriver.Chrome(chrome_path) else: raise Exception("Invalid Linux browser selection (Chrome and FF supported)") else: raise Exception("Operating system not supported")
Example #12
Source File: seleniumdriver.py From media-scraper with MIT License | 5 votes |
def get(driverType, localDriver=True, path='.'): driverType = str(driverType) if driverType == 'PhantomJS': # phantomjs_options.add_argument("--disable-web-security") if localDriver: source = get_source(driverType, path) driver = webdriver.PhantomJS(executable_path=source, service_log_path=join(path, 'phantomjs.log'), service_args=["--remote-debugger-port=9000", "--web-security=false"]) # driver = webdriver.PhantomJS(executable_path=source, service_args=["--remote-debugger-port=9000", "--web-security=false"]) else: driver = webdriver.PhantomJS(service_log_path=join(path, 'phantomjs.log'), service_args=["--remote-debugger-port=9000", "--web-security=false"]) # driver = webdriver.PhantomJS(service_args=["--remote-debugger-port=9000", "--web-security=false"]) elif driverType == 'Chrome': desired = DesiredCapabilities.CHROME desired['loggingPrefs'] = {'browser': 'ALL'} chrome_options = Options() chrome_options.add_argument("--start-maximized") chrome_options.add_argument("--disable-infobars") chrome_options.add_argument("--disable-web-security") # chrome_options.add_argument("--window-size=800,600") # chrome_options.add_argument("--headless") # will not show the Chrome browser window if localDriver: source = get_source(driverType, path) driver = webdriver.Chrome(executable_path=source, service_log_path=join(path, 'chromedriver.log'), desired_capabilities=desired, chrome_options=chrome_options) else: driver = webdriver.Chrome(service_log_path=join(path, 'chromedriver.log'), desired_capabilities=desired, chrome_options=chrome_options) elif driverType == 'Firefox': # desired = DesiredCapabilities.FIREFOX # desired['loggingPrefs'] = {'browser': 'ALL'} firefox_options = Options() firefox_options.add_argument("--start-maximized") firefox_options.add_argument("--disable-infobars") if localDriver: source = get_source(driverType, path) driver = webdriver.Firefox(executable_path=source, service_log_path=join(path, 'geckodriver.log'), firefox_options=firefox_options) else: driver = webdriver.Firefox(service_log_path=join(path, 'geckodriver.log'), firefox_options=firefox_options) return driver
Example #13
Source File: SeleniumTest.py From INGInious with GNU Affero General Public License v3.0 | 4 votes |
def setUp(self): self.frontend_config = { "backend": "remote", "docker_daemons": [{ "remote_host": "192.168.59.103", "remote_docker_port": 2375, "remote_agent_port": 63456 }], "mongo_opt": {"host": "localhost", "database": "INGIniousFrontendTest"}, "tasks_directory": "./inginious/tasks", "containers": { "default": "ingi/inginious-c-default", "sekexe": "ingi/inginious-c-sekexe", }, "superadmins": ["test"], "plugins": [ { "plugin_module": "inginious.frontend.plugins.auth.demo_auth", "users": {"test": "test", "test2": "test", "test3": "test"} } ] } if TEST_ENV == "boot2docker": self.display = None self.driver = webdriver.Remote(command_executor=(CUSTOM_SELENIUM_EXECUTOR or 'http://192.168.59.103:4444/wd/hub'), desired_capabilities=DesiredCapabilities.FIREFOX) self.base_url = CUSTOM_SELENIUM_BASE_URL or "http://192.168.59.3:8081" self.frontend_host = "192.168.59.3" self.frontend_port = 8081 self.frontend_ssh_port = 8082 elif TEST_ENV == "boot2docker-local": self.display = None self.driver = webdriver.Firefox() self.base_url = CUSTOM_SELENIUM_BASE_URL or "http://127.0.0.1:8081" self.frontend_host = "127.0.0.1" self.frontend_port = 8081 self.frontend_ssh_port = 8082 elif False and TEST_ENV == "jenkins": self.display = Display(visible=0, size=(1920, 1080)) self.display.start() self.driver = webdriver.Firefox() self.base_url = CUSTOM_SELENIUM_BASE_URL or "http://localhost:8081" self.frontend_host = "localhost" self.frontend_port = 8081 self.frontend_ssh_port = 8082 self.frontend_config["backend"] = "local" else: raise SkipTest("Env variable TEST_ENV is not properly configured. Please take a look a the documentation to properly configure your " "test environment.") self.driver.maximize_window() self.driver.implicitly_wait(30) self.verificationErrors = [] self.accept_next_alert = True _drop_database(self.frontend_config["mongo_opt"]) self.frontend_thread, self.frontend_server, self.close_app_func = _start_frontend(self.frontend_config, self.frontend_host, self.frontend_port, self.frontend_ssh_port)