How to use _get_driver_path method in webdriver_manager

Best Python code snippet using webdriver_manager

driver.py

Source:driver.py Github

copy

Full Screen

...27 driver = webdriver.Chrome()28 except WebDriverException as e:29 if self._is_debug:30 print('\nPlease note: \n', e)31 path = self._get_driver_path()32 if self._is_debug:33 print('\nTrying to look for a \'chromedriver\' under:\n{}'.format(path))34 driver = webdriver.Chrome(executable_path=path)35 if self._browser == 'mozilla':36 try:37 if self._config.is_headless:38 # Set the MOZ_HEADLESS environment variable which casues Firefox to start in headless mode.39 # Source: https://intoli.com/blog/running-selenium-with-headless-firefox/40 os.environ['MOZ_HEADLESS'] = '1'41 driver = webdriver.Firefox()42 else:43 driver = webdriver.Firefox()44 except WebDriverException as e:45 if self._is_debug:46 print('\nPlease note:', e.msg)47 path = self._get_driver_path()48 if self._is_debug:49 print('\nTrying to look for a \'geckodriver\' under:\n{}'.format(path))50 driver = webdriver.Firefox(executable_path=path)51 if self._browser == 'edge':52 '''53 Purpose: Probe the underlying platform’s hardware, operating system,54 and interpreter version information.55 print('Version tuple:', platform.python_version_tuple())56 print('Compiler :', platform.python_compiler())57 print('Build :', platform.python_build())58 '''59 if sum(int(i) for i in platform.python_version_tuple()) > 13:60 if self._is_debug:61 print('\nVersion:', platform.python_version())62 print('WebDriver is now a Feature On Demand')63 print('For more info please check: {}'.format(64 'https://blogs.windows.com/msedgedev/2018/06/14/'65 'webdriver-w3c-recommendation-feature-on-demand/#Rg8g2hRfjBQQVRXy.97\n'))66 driver = webdriver.Edge()67 else:68 path = self._get_driver_path()69 if self._is_debug:70 print('\nTrying to look for a \'MicrosoftWebDriver\' under:\n{}'.format(path))71 driver = webdriver.Edge(executable_path=path)72 return driver73 def _get_root_dir(self):74 root_dir = os.path.dirname(os.path.realpath(__file__)).split('\\')75 dir_list = [str(i) for i in root_dir]76 root_dir_index = dir_list.index("ParaBankSeleniumAutomation")77 root = '\\'.join(root_dir[:root_dir_index + 1])78 if self._is_debug:79 print('ROOT DIR:\n', root)80 return root81 def _get_driver_path(self):82 return self._get_root_dir() + self._driver_path[self._browser]83 #return 'G:\Polikek\maslakov\сайтик\chromedriver.exe'84 def get_driver(self):85 return self._driver86 def get_browser(self):...

Full Screen

Full Screen

my_fix.py

Source:my_fix.py Github

copy

Full Screen

...28 latest_release_url=latest_release_url,29 ie_release_tag=ie_release_tag,30 )31 def install(self):32 return self._get_driver_path(self.driver)33class EdgeChromiumDriverManager(DriverManager):34 def __init__(35 self,36 version="latest",37 os_type=utils.os_type(),38 path=r".\\Drivers",39 name="edgedriver",40 url="https://msedgedriver.azureedge.net",41 latest_release_url="https://msedgedriver.azureedge.net/LATEST_RELEASE",42 log_level=logging.INFO,43 print_first_line=None,44 cache_valid_range=1,45 ):46 super().__init__(path, log_level, print_first_line, cache_valid_range)47 self.driver = EdgeChromiumDriver(48 version=version,49 os_type=os_type,50 name=name,51 url=url,52 latest_release_url=latest_release_url,53 )54 def install(self):55 driver_path = self._get_driver_path(self.driver)56 os.chmod(driver_path, 0o755)...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run webdriver_manager automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful