Best Python code snippet using selene_python
config.py
Source:config.py
...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...
Check out the latest blogs from LambdaTest on this topic:
Lack of training is something that creates a major roadblock for a tester. Often, testers working in an organization are all of a sudden forced to learn a new framework or an automation tool whenever a new project demands it. You may be overwhelmed on how to learn test automation, where to start from and how to master test automation for web applications, and mobile applications on a new technology so soon.
The QA testing career includes following an often long, winding road filled with fun, chaos, challenges, and complexity. Financially, the spectrum is broad and influenced by location, company type, company size, and the QA tester’s experience level. QA testing is a profitable, enjoyable, and thriving career choice.
In some sense, testing can be more difficult than coding, as validating the efficiency of the test cases (i.e., the ‘goodness’ of your tests) can be much harder than validating code correctness. In practice, the tests are just executed without any validation beyond the pass/fail verdict. On the contrary, the code is (hopefully) always validated by testing. By designing and executing the test cases the result is that some tests have passed, and some others have failed. Testers do not know much about how many bugs remain in the code, nor about their bug-revealing efficiency.
The best agile teams are built from people who work together as one unit, where each team member has both the technical and the personal skills to allow the team to become self-organized, cross-functional, and self-motivated. These are all big words that I hear in almost every agile project. Still, the criteria to make a fantastic agile team are practically impossible to achieve without one major factor: motivation towards a common goal.
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!