Comments (3)
@symonk There is a way to do it. It requires a few things. One is creating a custom tearDown() method in your test suite that runs before the SeleniumBase one. See https://github.com/seleniumbase/SeleniumBase/blob/master/examples/boilerplates/base_test_case.py . Next, you’ll need to use self.driver.add_cookie() to add the cookie you want in your custom tearDown() method. You’ll also need to know if your test already passed or failed in that tearDown, so you can set a global variable on the last line of your test, which will only be reached if the test has passed. Your custom tearDown will look at that variable to know what to set your cookie to. I’ve used sb_config to pass variables from the pytest_plugin to base_case.
from seleniumbase.
And as mentioned in Gitter chat, you can detect test failures in tearDown() with:
has_exception = False
if sys.version.startswith('3') and hasattr(self, '_outcome'):
if hasattr(self._outcome, 'errors') and self._outcome.errors:
has_exception = True
else:
has_exception = sys.exc_info()[1] is not None
from seleniumbase.
Hope to support zalenium。
from seleniumbase.
Related Issues (20)
- Unable to pass cloudflare using UC Mode HOT 2
- Integrate Type Checks, to improve development experience. HOT 1
- Maintainer away for 3 days. Hold your questions until April 10. HOT 2
- Comparison between playwright and seleniumbase? HOT 4
- Is it possible to add selenum webdriver remote with seleniumbase. HOT 1
- How to add saved cookies to a new browser HOT 2
- Browser asks for SSL authentication in Selenium Grid. HOT 3
- When the previous step page is not yet fully loaded, the self. open() of the next step has already been run directly HOT 2
- I hope this script can use the previous browser HOT 11
- Unable to record keystrokes
- Can't pass bot detection on dexscreener.com on Linux HOT 7
- Add UC Mode `driver` methods directly into the `SB` API HOT 1
- Some elements cannot be inputted using the input method HOT 1
- Session Time Out while trying to spawn broswer in Docker HOT 1
- Timezone problem on pixelscan test HOT 2
- Failing Docker tests when running on M2 mac HOT 4
- Docker overhaul needed HOT 2
- Encountered InvalidSessionIdException occasionally in local docker run HOT 6
- Freezes on ChromeOS when loading Driver HOT 2
- How to open a file *.html? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from seleniumbase.