예제 #1
0
    def get_remote_html_validator(self):
        self.auth_token = get_encoded_auth_token()
        self.custom_modified_headers = create_modheaders_plugin(
            remove_headers=[],
            add_or_modify_headers={
                "Authorization": self.auth_token
            }
        )
        self.desired_capabilities = webdriver.DesiredCapabilities.CHROME
        self.desired_capabilities['loggingPrefs'] = {'browser': 'ALL'}

        self.chrome_options = webdriver.ChromeOptions()
        self.chrome_options.add_argument(
            "--disable-plugins --disable-instant-extended-api \
            --headless")
        self.dir = os.path.dirname(__file__)
        self.path = os.path.join(
            self.dir, '../../../qa/utilities/html_validator/Validity.crx')
        self.chrome_options.add_extension(self.path)
        self.desired_capabilities.update(self.chrome_options.to_capabilities())
        self.browser = webdriver.Remote(
            command_executor=SELENIUM,
            desired_capabilities=self.desired_capabilities
        )
        return self.browser
예제 #2
0
    def get_local_ga_chrome(self):
        self.auth_token = get_encoded_auth_token()
        self.custom_modified_headers = create_modheaders_plugin(
            remove_headers=[],
            add_or_modify_headers={
                "Authorization": self.auth_token
            }
        )
        self.desired_capabilities = webdriver.DesiredCapabilities.CHROME
        self.desired_capabilities['loggingPrefs'] = {'browser': 'ALL'}

        self.chrome_options = webdriver.ChromeOptions()
        self.chrome_options.add_extension(
            '%senv/bin/ga_tracker.crx' % QA_FOLDER_PATH)
        self.chrome_options.add_extension(self.custom_modified_headers)
        self.driver = webdriver.Chrome(chrome_options=self.chrome_options)
        return self.driver
예제 #3
0
 def get_headless_authenticated_chrome_driver(self):
     self.auth_token = get_encoded_auth_token()
     self.custom_modified_headers = create_modheaders_plugin(
         remove_headers=[],
         add_or_modify_headers={
             "Authorization": self.auth_token
         }
     )
     self.desired_capabilities = webdriver.DesiredCapabilities.CHROME
     self.desired_capabilities['loggingPrefs'] = {'browser': 'ALL'}
     self.chrome_options = webdriver.ChromeOptions()
     self.chrome_options.add_argument(
         "--disable-plugins --disable-instant-extended-api --headless")
     self.chrome_options.add_extension(self.custom_modified_headers)
     self.desired_capabilities.update(self.chrome_options.to_capabilities())
     self.browser = webdriver.Chrome(
         executable_path='chromedriver',
         desired_capabilities=self.desired_capabilities
     )
     # Desktop size
     set_defaults(self.browser)
     return self.browser
예제 #4
0
 def get_custom_emulation(self):
     self.auth_token = get_encoded_auth_token()
     self.custom_modified_headers = create_modheaders_plugin(
         remove_headers=[],
         add_or_modify_headers={
             "Authorization": self.auth_token
         }
     )
     custom_device = {
         'deviceMetrics': {'width': 360, 'height': 640, 'pixelRatio': 3.0},
         'userAgent': 'Mozilla/5.0 (Linux; Android 4.2.1; en-us; Nexus 5 \
         Build/JOP40D) AppleWebKit/535.19 (KHTML, like Gecko) \
         Chrome/18.0.1025.166 Mobile Safari/535.19'
     }
     self.chrome_options = webdriver.ChromeOptions()
     self.chrome_options.add_argument("--start-maximized")
     self.chrome_options.add_experimental_option(
         "mobileEmulation", custom_device)
     self.chrome_options.add_extension(self.custom_modified_headers)
     self.browser = webdriver.Chrome(
         executable_path='chromedriver',
         chrome_options=self.chrome_options
     )
     return self.browser
예제 #5
0
 def get_iphone_7_emulation(self):
     self.auth_token = get_encoded_auth_token()
     self.custom_modified_headers = create_modheaders_plugin(
         remove_headers=[],
         add_or_modify_headers={
             "Authorization": self.auth_token
         }
     )
     self.device = {
         'deviceMetrics': {'width': 750, 'height': 1334, 'pixelRatio': 2.0},
         'userAgent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 10_2_1 like Mac OS X) \
         AppleWebKit/602.4.6 (KHTML, like Gecko) \
         Version/10.0 Mobile/14D27 Safari/602.1'
     }
     self.chrome_options = webdriver.ChromeOptions()
     self.chrome_options.add_argument("--start-maximized")
     self.chrome_options.add_experimental_option(
         "mobileEmulation", self.device)
     self.chrome_options.add_extension(self.custom_modified_headers)
     self.browser = webdriver.Chrome(
         executable_path='chromedriver',
         chrome_options=self.chrome_options
     )
     return self.browser
예제 #6
0
 def get_nexus_5x_emulation(self):
     self.auth_token = get_encoded_auth_token()
     self.custom_modified_headers = create_modheaders_plugin(
         remove_headers=[],
         add_or_modify_headers={
             "Authorization": self.auth_token
         }
     )
     self.device = {
         'deviceMetrics': {'width': 1080, 'height': 1920, 'pixelRatio': 2.6},
         'userAgent': 'mozilla/5.0 (Linux; Android 6.0.1; \
         Nexus 5x build/mtc19t applewebkit/537.36 (KHTML, like Gecko) \
         Chrome/51.0.2702.81 Mobile Safari/537.36'
     }
     self.chrome_options = webdriver.ChromeOptions()
     self.chrome_options.add_argument("--start-maximized")
     self.chrome_options.add_experimental_option(
         "mobileEmulation", self.device)
     self.chrome_options.add_extension(self.custom_modified_headers)
     self.browser = webdriver.Chrome(
         executable_path='chromedriver',
         chrome_options=self.chrome_options
     )
     return self.browser
예제 #7
0
 def get_galaxy_s8_emulation(self):
     self.auth_token = get_encoded_auth_token()
     self.custom_modified_headers = create_modheaders_plugin(
         remove_headers=[],
         add_or_modify_headers={
             "Authorization": self.auth_token
         }
     )
     self.device = {
         'deviceMetrics': {'width': 1440, 'height': 2960, 'pixelRatio': 4.0},
         'userAgent': 'mozilla/5.0 (Linux; Android 7.0; \
         SM-G892A Build/NRD90M applewebkit/537.36 (KHTML, like Gecko) \
         Chrome/56.0.2924.87 Mobile Safari/537.36'
     }
     self.chrome_options = webdriver.ChromeOptions()
     self.chrome_options.add_argument("--start-maximized")
     self.chrome_options.add_experimental_option(
         "mobileEmulation", self.device)
     self.chrome_options.add_extension(self.custom_modified_headers)
     self.browser = webdriver.Chrome(
         executable_path='chromedriver',
         chrome_options=self.chrome_options
     )
     return self.browser