-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Configure browser capabilities through YAML #36
base: master
Are you sure you want to change the base?
Conversation
Need to write tests for these.
Allow the user to select their appropriate browser config via the WEBDRIVER environment variable.
Refactor requirements lists to be more straightforward.
|
||
world.browser.execute_script(""" | ||
try { | ||
$(window).off('beforeunload'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, this depends on JQuery being installed in and exported by the target site. I'm not really comfortable making that a requirement for lettuce_webdriver; is there a better or easier way to do this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. We can do it through raw JS. Although I've never been clear how
the multiple ways to set/unset events interact with each other in different
browsers. I'll investigate.
On 2 October 2013 04:50, Nicholas Pilon [email protected] wrote:
In lettuce_webdriver/init.py:
- driver.config = config
- driver.requested_capabilities = caps
- return driver
[email protected]_scenario # pylint:disable=no-member
+def disable_beforeunload(scenario):
- """
- Disable before unload after a scenario so that the next scenario can
- reload the site.
- """
- world.browser.execute_script("""
+try {- $(window).off('beforeunload');
So, this depends on JQuery being installed in and exported by the target
site. I'm not really comfortable making that a requirement for
lettuce_webdriver; is there a better or easier way to do this?—
Reply to this email directly or view it on GitHubhttps://github.com//pull/36/files#r6695360
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may also want to add a callback to selenium that checks on each page load to see if JQuery is exposed and, if it isn't, imports and exposes it...
So, having looked at this in depth. It looks non-trivial to make it work without jQuery. So we can either remove it completely, or just leave it there. If you don't have jQuery, it will become a no-op because the exception will be caught and ignored.. |
See SHA: 42ebae3 - I got fed up with not having JQuery Selectors available when writing tests using CSS selector steps, so I made a couple of utility functions to handle it. If you'd like to steal these, and incorporate them here, I think that would be a clear win. |
Replace code configured webdrivers with a YAML config. Replace documentation with a standard initialize call.
YAML is neat because it makes it easier to set up multiple browser configs for running your tests, especially because YAML supports inheritance, so you can do a lot of defaulting.
This branch includes some fixes for the Django steps, and the onbeforeunload fix.