diff --git a/Readme.md b/Readme.md index 3c17c8e8..88b478dd 100644 --- a/Readme.md +++ b/Readme.md @@ -214,6 +214,8 @@ c) If your are using firefox 47 and above, you need to set up Geckodriver. Refer d) On Ubuntu, you may run into an issue installing the cryptography module. You need to `sudo apt-get install libssl-dev` and then run `sudo pip install -r requirements.txt` +e) The Edge in Windows can not be downloaded automatically to the local cache (~/.cache/selenium) by Selenium Manager as it requires administrative access. When Edge is attempted to installed with Selenium Manager it will through ``edge can only be installed in Windows with administrator permissions.`` + ----------- Continuous Integration and Support ----------- diff --git a/conftest.py b/conftest.py index d4cceaee..626fc0e4 100644 --- a/conftest.py +++ b/conftest.py @@ -130,6 +130,8 @@ def test_obj(base_url, browser, browser_version, os_version, os_name, remote_fla elif os.getenv('REMOTE_BROWSER_PLATFORM') == 'BS' and remote_flag.lower() == 'y': test_obj.execute_javascript("""browserstack_executor: {"action": "setSessionStatus", "arguments": {"status":"failed", "reason": "Exception occured"}}""") + if browser == "edge": + print(f"Selenium Manager requires administrator permissions to install Microsoft {browser} in Windows automatically ") @pytest.fixture def test_mobile_obj(mobile_os_name, mobile_os_version, device_name, app_package, app_activity, # pylint: disable=redefined-outer-name too-many-arguments too-many-locals @@ -684,7 +686,7 @@ def pytest_addoption(parser): dest="browser", action="append", default=[], - help="Browser. Valid options are firefox, ie and chrome") + help="Browser. Valid options are firefox, Edge and chrome") parser.addoption("--app_url", dest="url", default=base_url_conf.ui_base_url, diff --git a/core_helpers/drivers/driverfactory.py b/core_helpers/drivers/driverfactory.py index 9e7f0703..890cc8ee 100644 --- a/core_helpers/drivers/driverfactory.py +++ b/core_helpers/drivers/driverfactory.py @@ -67,8 +67,8 @@ def get_local_driver(self, browser, browser_version): browser_version = None if browser.lower() == "ff" or browser.lower() == 'firefox': local_driver = self.firefox_local(browser_version) - elif browser.lower() == "ie": - local_driver = self.explorer_local(browser_version) + elif browser.lower() == "edge": + local_driver = self.edge_local(browser_version) elif browser.lower() == "chrome": local_driver = self.chrome_local(browser_version) elif browser.lower() == "opera": diff --git a/core_helpers/drivers/local_options.py b/core_helpers/drivers/local_options.py index 2e631280..910f90ca 100644 --- a/core_helpers/drivers/local_options.py +++ b/core_helpers/drivers/local_options.py @@ -18,11 +18,11 @@ def firefox_local(browser_version): return local_driver @staticmethod - def explorer_local(browser_version): - """Get webdriver for internet explorer.""" - options = webdriver.IeOptions() + def edge_local(browser_version): + """Get webdriver for Edge.""" + options = webdriver.EdgeOptions() options.browser_version = browser_version - local_driver = webdriver.Ie() + local_driver = webdriver.Edge(options=options) return local_driver diff --git a/core_helpers/web_app_helper.py b/core_helpers/web_app_helper.py index 12f59ef8..ddee0508 100644 --- a/core_helpers/web_app_helper.py +++ b/core_helpers/web_app_helper.py @@ -2,9 +2,8 @@ Page class that all page models can inherit from There are useful wrappers for common Selenium operations """ - +import inspect from selenium.webdriver.common.by import By -import os,inspect from core_helpers.drivers.driverfactory import DriverFactory from .selenium_action_objects import Selenium_Action_Objects from .remote_objects import Remote_Objects @@ -248,7 +247,7 @@ def switch_frame(self,name=None,index=None,wait_time=2): def get_element_attribute_value(self,element,attribute_name): "Return the elements attribute value if present" attribute_value = None - if (hasattr(element,attribute_name)): + if hasattr(element,attribute_name): attribute_value = element.get_attribute(attribute_name) return attribute_value @@ -278,14 +277,14 @@ def accessibility_inject_axe(self): try: return self.axe_util.inject() except Exception as e: - self.write(str(e),'critical') + self.write(str(e),'critical') def accessibility_run_axe(self): "Run Axe into the Page" try: return self.axe_util.run() except Exception as e: - self.write(str(e),'critical') + self.write(str(e),'critical') def snapshot_assert_match(self, value, snapshot_name): "Asserts the current value of the snapshot with the given snapshot_name" @@ -294,7 +293,7 @@ def snapshot_assert_match(self, value, snapshot_name): self.snapshot_util.assert_match(value, snapshot_name) result_flag = True except Exception as e: - self.write(str(e),'critical') + self.write(str(e),'critical') return result_flag diff --git a/integrations/cross_browsers/remote_options.py b/integrations/cross_browsers/remote_options.py index a149768c..af5bf4f2 100644 --- a/integrations/cross_browsers/remote_options.py +++ b/integrations/cross_browsers/remote_options.py @@ -2,7 +2,7 @@ Set the desired option for running the test on a remote platform. """ from selenium.webdriver.firefox.options import Options as FirefoxOptions -from selenium.webdriver.ie.options import Options as IeOptions +from selenium.webdriver.edge.options import Options as EdgeOptions from selenium.webdriver.chrome.options import Options as ChromeOptions from selenium.webdriver.safari.options import Options as SafariOptions from appium.options.android import UiAutomator2Options @@ -20,9 +20,9 @@ def firefox(browser_version): return options @staticmethod - def explorer(browser_version): - """Set web browser as Explorer.""" - options = IeOptions() + def edge(browser_version): + """Set web browser as Edge.""" + options = EdgeOptions() options.browser_version = browser_version return options @@ -47,8 +47,8 @@ def get_browser(self, browser, browser_version): """Select the browser.""" if browser.lower() == 'ff' or browser.lower() == 'firefox': desired_capabilities = self.firefox(browser_version) - elif browser.lower() == 'ie': - desired_capabilities = self.explorer(browser_version) + elif browser.lower() == 'edge': + desired_capabilities = self.edge(browser_version) elif browser.lower() == 'chrome': desired_capabilities = self.chrome(browser_version) elif browser.lower() == 'safari':