How to use _set_chrome_or_firefox_from_webdriver_manager method in Selene

Best Python code snippet using selene_python

config.py

Source: config.py Github

copy

Full Screen

...118 self._set_driver = lambda: driver119 self._source.create()120 else:121 auto_set_driver = (122 lambda: self._set_chrome_or_firefox_from_webdriver_manager()123 )124 self._set_driver = set_driver or auto_set_driver125 self._save_screenshot_on_failure = save_screenshot_on_failure126 self._save_page_source_on_failure = save_page_source_on_failure127 self._poll_during_waits = poll_during_waits128 self._counter = counter or itertools.count(129 start=int(round(time.time() * 1000))130 )131 self._reports_folder = reports_folder or os.path.join(132 os.path.expanduser('~'),133 '.selene',134 'screenshots',135 str(next(self._counter)),136 )137 self._last_screenshot = (138 last_screenshot139 if isinstance(last_screenshot, Source)140 else Source(last_screenshot)141 )142 self._last_page_source = (143 last_page_source144 if isinstance(last_page_source, Source)145 else Source(last_page_source)146 )147 super().__init__(148 driver=driver,149 timeout=timeout,150 base_url=base_url,151 set_value_by_js=set_value_by_js,152 type_by_js=type_by_js,153 wait_for_no_overlap_found_by_js=wait_for_no_overlap_found_by_js,154 window_width=window_width,155 window_height=window_height,156 hook_wait_failure=hook_wait_failure,157 log_outer_html_on_failure=log_outer_html_on_failure,158 )159 def _set_chrome_or_firefox_from_webdriver_manager(self):160 def get_chrome():161 return Chrome(162 service=ChromeService(163 ChromeDriverManager(164 chrome_type=ChromeType.CHROMIUM165 ).install()166 ),167 options=ChromeOptions(),168 )169 def get_firefox():170 return Firefox(171 service=FirefoxService(GeckoDriverManager().install())172 )173 return {'chrome': get_chrome, 'firefox': get_firefox}.get(174 self.browser_name175 )()176 @property177 def driver(self) -> WebDriver:178 return self._source.instance179 def get_or_create_driver(self) -> WebDriver:180 return self._source.get_or_create()181 def quit_driver(self):182 warnings.warn(183 'shared.config.quit_driver is deprecated, '184 'use shared.config.reset_driver instead',185 DeprecationWarning,186 )187 self.reset_driver()188 def reset_driver(self):189 self.set_driver = (190 lambda: self._set_chrome_or_firefox_from_webdriver_manager()191 )192 @driver.setter193 def driver(self, value: WebDriver):194 self.set_driver = (195 lambda: value196 )197 self._source.create()198 @property199 def set_driver(self):200 return self._set_driver201 @set_driver.setter202 def set_driver(self, value: Callable[[], WebDriver]):203 self._source.quit()204 self._set_driver = value...

Full Screen

Full Screen

Blogs

Check out the latest blogs from LambdaTest on this topic:

Stop Losing Money. Invest in Software Testing

I was once asked at a testing summit, “How do you manage a QA team using scrum?” After some consideration, I realized it would make a good article, so here I am. Understand that the idea behind developing software in a scrum environment is for development teams to self-organize.

30 Top Automation Testing Tools In 2022

The sky’s the limit (and even beyond that) when you want to run test automation. Technology has developed so much that you can reduce time and stay more productive than you used to 10 years ago. You needn’t put up with the limitations brought to you by Selenium if that’s your go-to automation testing tool. Instead, you can pick from various test automation frameworks and tools to write effective test cases and run them successfully.

Difference Between Web And Mobile Application Testing

Smartphones have changed the way humans interact with technology. Be it travel, fitness, lifestyle, video games, or even services, it’s all just a few touches away (quite literally so). We only need to look at the growing throngs of smartphone or tablet users vs. desktop users to grasp this reality.

Why does DevOps recommend shift-left testing principles?

Companies are using DevOps to quickly respond to changing market dynamics and customer requirements.

What Agile Testing (Actually) Is

So, now that the first installment of this two fold article has been published (hence you might have an idea of what Agile Testing is not in my opinion), I’ve started feeling the pressure to explain what Agile Testing actually means to me.

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 Selene 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