bbangert / lettuce_webdriver Goto Github PK
View Code? Open in Web Editor NEWSelenium webdriver for lettuce
License: MIT License
Selenium webdriver for lettuce
License: MIT License
The following step:
Then I should see "A unicorn"
will match on an HTML:
<div>
<span style="display: none">A</span> <span style="display: none">unicorn</span>
</div>
because even though none of the spans are visible, the outer div
is, and it contains the specified text.
Same issue in Aloe Webdriver: aloetesting/aloe_webdriver#13
attn @npilon
For example I'd like to pass and argument specifying the domain the tests should run against.
So in my steps, say, i have something like;
@step(u'I sign in')
def sign_in(step):
world.browser.get('https://www.example.com/')
inputElement = world.browser.find_element_by_id("login")
world.browser.find_element_by_id("email").send_keys("[email protected]")
world.browser.find_element_by_id("password").send_keys("foo")
inputElement.submit()
assert "Landing" in world.browser.title
Instead of hard coding the full url inside each step itself, it would be helpful to pass the domain in the lettuce command. Maybe in this manner,
$lettuce some.feature --testhost=http://www.example.com
or to run same test against staging
$lettuce some.feature --testhost=http://stage.example.com
Lettuce doesn't appear to handle this use case. There are some packages that support this but they require and are intended for use in a Django project.
I tried looking into adding argparse in the terrain.py, but that didn't seem to work.
Long story short, I'm wondering if this is something the webdriver itself could handle?
Exception:
Then I should see "Search Results for Iñtërnâtiônàlizætiøn" within 10 seconds # home/shawn/.virtualenvs/deus_lex/local/lib/python2.7/site-packages/lettuce_webdriver/webdriver.py:152 Traceback (most recent call last): File "/home/shawn/.virtualenvs/deus_lex/local/lib/python2.7/site-packages/lettuce/core.py", line 144, in __call__ ret = self.function(self.step, *args, **kw) File "/home/shawn/.virtualenvs/deus_lex/local/lib/python2.7/site-packages/lettuce_webdriver/webdriver.py", line 153, in should_see_in_seconds wait_for_content(step, world.browser, text, int(timeout)) File "/home/shawn/.virtualenvs/deus_lex/local/lib/python2.7/site-packages/lettuce_webdriver/webdriver.py", line 62, in wait_for_content if contains_content(world.browser, content): File "/home/shawn/.virtualenvs/deus_lex/local/lib/python2.7/site-packages/lettuce_webdriver/webdriver.py", line 37, in contains_content .format(content=content))): UnicodeEncodeError: 'ascii' codec can't encode character u'\xf1' in position 20: ordinal not in range(128)
Full test of scenario:
Scenario: 1. I want the search bar on the landing page to work as expected
Given I point browser to "/"
And I fill in $("#main-search input[name=q]") with "Iñtërnâtiônàlizætiøn"
And I click $("#main-search .btn-default")
Then I should see "Search Results for Iñtërnâtiônàlizætiøn" within 10 seconds
Hi Guys,
I have installed lettuce-webdriver, but can't figure out why my test doesn't work
as you see below - it doesn't execute it but just ask me to create "assert/test" methods by myself. What do I miss?
thanks,
C:\Users\Dmitry\Default\Scripts>lettuce.exe web/feature
Feature: Test Saritasa # \web\feature:1
Scenario: Filling out the signup form # \web\feature:2
Given I go to "http://foo.com/signup" # \web\feature:3
When I fill in "Name" with "Foo Bar" # \web\feature:4
And I fill in "Email" with "[email protected]" # \web\feature:5
And I fill in "City" with "San Jose" # \web\feature:6
And I fill in "State" with "CA" # \web\feature:7
And I uncheck "Send me spam!" # \web\feature:8
And I select "Male" from "Gender" # \web\feature:9
And I press "Sign up" # \web\feature:10
Then I should see "Thank you for signing up!" # \web\feature:11
1 feature (0 passed)
1 scenario (0 passed)
9 steps (9 undefined, 0 passed)
You can implement step definitions for undefined steps with these snippets:
from lettuce import step
@step(u'Given I go to "([^"])"')
def given_i_go_to_group1(step, group1):
assert False, 'This step must be implemented'
@step(u'When I fill in "([^"])" with "([^"])"')
def when_i_fill_in_group1_with_group2(step, group1, group2):
assert False, 'This step must be implemented'
@step(u'And I fill in "([^"])" with "([^"])"')
def and_i_fill_in_group1_with_group2(step, group1, group2):
assert False, 'This step must be implemented'
@step(u'And I uncheck "([^"])"')
def and_i_uncheck_group1(step, group1):
assert False, 'This step must be implemented'
@step(u'And I select "([^"])" from "([^"])"')
def and_i_select_group1_from_group2(step, group1, group2):
assert False, 'This step must be implemented'
@step(u'And I press "([^"])"')
def and_i_press_group1(step, group1):
assert False, 'This step must be implemented'
@step(u'Then I should see "([^"])"')
def then_i_should_see_group1(step, group1):
assert False, 'This step must be implemented'
Hi,
Lettuce supports multiple languages. lettuce_webdriver should support those languages too.
Or at least, defining new translations should not duplicate the webdriver logic (for now I copied webdriver.py steps to my terrain.py file and translated the steps).
"
Hi Shawn,
Thank you for writing in.
We have activated the annual ‘Basic Automate’ plan for your ‘Lex Machina’ Team on BrowserStack. In exchange, we request a mention of BrowserStack on your GitHub project page and website.
Please let us know if you need any additional details, we will be glad to help.
Regards,
Pragnya Mehta
www.browserstack.com"
I assume you've seen https://travis-ci.org/infoxchange/lettuce_webdriver/jobs/18179534 ?
@after_all seems to be firing after every feature run, not after all the features.
Test is the example from lettuce.it
With a second copy of the feature to have more then one feature running. I can gist the tests if needed.
Each test done in it's own virturalenv against the same exact /feature directory.
The terrain file looks like
from lettuce import *
@after.all
def say_goodbye(total):
report_message = "%d of %d scenarios passed." % (
total.scenarios_passed,
total.scenarios_ran
)
print report_message
print "After All -- Goodbye!"
@after.each_feature
def teardown_some_feature(feature):
print "The feature %r just has just ran" % feature.name
Enough said :)
Lettuce allows you to use relative urls in your features so it doesn't matter what the server address is (e.g. "/hello_world/"). You can then use
from lettuce.django import django_url
django_url(url)
to get the correct url.
Currently, lettuce_webdriver does not seem to be working with relative URLs, however this would be very nice to have implemented.
Our tests running against Browserstack sometimes falsely report all test passing.
While strictly speaking none of the tests failed, they certainly didn't all run.
For example,
WebDriverException: Message: u'5 sessions are currently being used. Please upgrade to add more parallel sessions.'
Individual Features failed with
Died with Message: u'5 sessions are currently being used. Please upgrade to add more parallel sessions.'
Full text of report below;
Traceback (most recent call last):
File "/home/lex/local/lib/python2.7/site-packages/lettuce/registry.py", line 88, in call_hook
callback(*args, **kw)
File "/home/lex/src/deus_lex/winslow/tests/features/terrain.py", line 40, in setup_browser
secret=world.browserstack_secret,
File "/home/lex/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 71, in __init__
self.start_session(desired_capabilities, browser_profile)
File "/home/lex/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 113, in start_session
'desiredCapabilities': desired_capabilities,
File "/home/lex/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 164, in execute
self.error_handler.check_response(response)
File "/home/lex/local/lib/python2.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 164, in check_response
raise exception_class(message, screen, stacktrace)
WebDriverException: Message: u'5 sessions are currently being used. Please upgrade to add more parallel sessions.'
Traceback (most recent call last):
File "/home/lex/local/lib/python2.7/site-packages/lettuce_webdriver/parallel_runner.py", line 157, in worker_process
failfast=self.failfast))
File "/home/lex/local/lib/python2.7/site-packages/lettuce/core.py", line 1166, in run
call_hook('before_each', 'feature', self)
File "/home/lex/local/lib/python2.7/site-packages/lettuce/registry.py", line 88, in call_hook
callback(*args, **kw)
File "/home/lex/src/deus_lex/winslow/tests/features/terrain.py", line 40, in setup_browser
secret=world.browserstack_secret,
File "/home/lex/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 71, in __init__
self.start_session(desired_capabilities, browser_profile)
File "/home/lex/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 113, in start_session
'desiredCapabilities': desired_capabilities,
File "/home/lex/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 164, in execute
self.error_handler.check_response(response)
File "/home/lex/local/lib/python2.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 164, in check_response
raise exception_class(message, screen, stacktrace)
WebDriverException: Message: u'5 sessions are currently being used. Please upgrade to add more parallel sessions.'
Traceback (most recent call last):
File "/home/lex/local/lib/python2.7/site-packages/lettuce/registry.py", line 88, in call_hook
callback(*args, **kw)
File "/home/lex/src/deus_lex/winslow/tests/features/terrain.py", line 40, in setup_browser
secret=world.browserstack_secret,
File "/home/lex/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 71, in __init__
self.start_session(desired_capabilities, browser_profile)
File "/home/lex/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 113, in start_session
'desiredCapabilities': desired_capabilities,
File "/home/lex/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 164, in execute
self.error_handler.check_response(response)
File "/home/lex/local/lib/python2.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 164, in check_response
raise exception_class(message, screen, stacktrace)
WebDriverException: Message: u'5 sessions are currently being used. Please upgrade to add more parallel sessions.'
Traceback (most recent call last):
File "/home/lex/local/lib/python2.7/site-packages/lettuce_webdriver/parallel_runner.py", line 157, in worker_process
failfast=self.failfast))
File "/home/lex/local/lib/python2.7/site-packages/lettuce/core.py", line 1166, in run
call_hook('before_each', 'feature', self)
File "/home/lex/local/lib/python2.7/site-packages/lettuce/registry.py", line 88, in call_hook
callback(*args, **kw)
File "/home/lex/src/deus_lex/winslow/tests/features/terrain.py", line 40, in setup_browser
secret=world.browserstack_secret,
File "/home/lex/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 71, in __init__
self.start_session(desired_capabilities, browser_profile)
File "/home/lex/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 113, in start_session
'desiredCapabilities': desired_capabilities,
File "/home/lex/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 164, in execute
self.error_handler.check_response(response)
File "/home/lex/local/lib/python2.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 164, in check_response
raise exception_class(message, screen, stacktrace)
WebDriverException: Message: u'5 sessions are currently being used. Please upgrade to add more parallel sessions.'
Traceback (most recent call last):
File "/home/lex/local/lib/python2.7/site-packages/lettuce/registry.py", line 88, in call_hook
callback(*args, **kw)
File "/home/lex/src/deus_lex/winslow/tests/features/terrain.py", line 40, in setup_browser
secret=world.browserstack_secret,
File "/home/lex/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 71, in __init__
self.start_session(desired_capabilities, browser_profile)
File "/home/lex/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 113, in start_session
'desiredCapabilities': desired_capabilities,
File "/home/lex/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 164, in execute
self.error_handler.check_response(response)
File "/home/lex/local/lib/python2.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 164, in check_response
raise exception_class(message, screen, stacktrace)
WebDriverException: Message: u'5 sessions are currently being used. Please upgrade to add more parallel sessions.'
Traceback (most recent call last):
File "/home/lex/local/lib/python2.7/site-packages/lettuce_webdriver/parallel_runner.py", line 157, in worker_process
failfast=self.failfast))
File "/home/lex/local/lib/python2.7/site-packages/lettuce/core.py", line 1166, in run
call_hook('before_each', 'feature', self)
File "/home/lex/local/lib/python2.7/site-packages/lettuce/registry.py", line 88, in call_hook
callback(*args, **kw)
File "/home/lex/src/deus_lex/winslow/tests/features/terrain.py", line 40, in setup_browser
secret=world.browserstack_secret,
File "/home/lex/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 71, in __init__
self.start_session(desired_capabilities, browser_profile)
File "/home/lex/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 113, in start_session
'desiredCapabilities': desired_capabilities,
File "/home/lex/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 164, in execute
self.error_handler.check_response(response)
File "/home/lex/local/lib/python2.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 164, in check_response
raise exception_class(message, screen, stacktrace)
WebDriverException: Message: u'5 sessions are currently being used. Please upgrade to add more parallel sessions.'
I need to be sure I am signed out for many of the auth steps to work properly ... OK
Sign in with incorrect email ... OK
Sign in with incorrect password ... OK
Standard Sign in ... OK
Sign up with Expired Token ... OK
Sign up with Expired Token that Expires after a number of days ... OK
Sign up with Expired Token that Expires after a specific date ... OK
Sign in with Disabled Account ... OK
Sign in with Expired Trial ... OK
I sign out ... OK
1 feature (1 passed)
10 scenarios (10 passed)
41 steps (41 passed)
========================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
Died with Message: u'5 sessions are currently being used. Please upgrade to add more parallel sessions.'
0 feature (0 passed)
0 scenario (0 passed)
0 step (0 passed)
========================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
Died with Message: u'5 sessions are currently being used. Please upgrade to add more parallel sessions.'
0 feature (0 passed)
0 scenario (0 passed)
0 step (0 passed)
========================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
Died with Message: u'5 sessions are currently being used. Please upgrade to add more parallel sessions.'
0 feature (0 passed)
0 scenario (0 passed)
0 step (0 passed)
========================================================================Traceback (most recent call last):
File "/home/lex/local/lib/python2.7/site-packages/lettuce/registry.py", line 88, in call_hook
callback(*args, **kw)
File "/home/lex/src/deus_lex/winslow/tests/features/terrain.py", line 40, in setup_browser
secret=world.browserstack_secret,
File "/home/lex/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 71, in __init__
self.start_session(desired_capabilities, browser_profile)
File "/home/lex/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 113, in start_session
'desiredCapabilities': desired_capabilities,
File "/home/lex/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 164, in execute
self.error_handler.check_response(response)
File "/home/lex/local/lib/python2.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 164, in check_response
raise exception_class(message, screen, stacktrace)
WebDriverException: Message: u'5 sessions are currently being used. Please upgrade to add more parallel sessions.'
Traceback (most recent call last):
File "/home/lex/local/lib/python2.7/site-packages/lettuce_webdriver/parallel_runner.py", line 157, in worker_process
failfast=self.failfast))
File "/home/lex/local/lib/python2.7/site-packages/lettuce/core.py", line 1166, in run
call_hook('before_each', 'feature', self)
File "/home/lex/local/lib/python2.7/site-packages/lettuce/registry.py", line 88, in call_hook
callback(*args, **kw)
File "/home/lex/src/deus_lex/winslow/tests/features/terrain.py", line 40, in setup_browser
secret=world.browserstack_secret,
File "/home/lex/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 71, in __init__
self.start_session(desired_capabilities, browser_profile)
File "/home/lex/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 113, in start_session
'desiredCapabilities': desired_capabilities,
File "/home/lex/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 164, in execute
self.error_handler.check_response(response)
File "/home/lex/local/lib/python2.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 164, in check_response
raise exception_class(message, screen, stacktrace)
WebDriverException: Message: u'5 sessions are currently being used. Please upgrade to add more parallel sessions.'
Traceback (most recent call last):
File "/home/lex/local/lib/python2.7/site-packages/lettuce/registry.py", line 88, in call_hook
callback(*args, **kw)
File "/home/lex/src/deus_lex/winslow/tests/features/terrain.py", line 40, in setup_browser
secret=world.browserstack_secret,
File "/home/lex/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 71, in __init__
self.start_session(desired_capabilities, browser_profile)
File "/home/lex/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 113, in start_session
'desiredCapabilities': desired_capabilities,
File "/home/lex/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 164, in execute
self.error_handler.check_response(response)
File "/home/lex/local/lib/python2.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 164, in check_response
raise exception_class(message, screen, stacktrace)
WebDriverException: Message: u'5 sessions are currently being used. Please upgrade to add more parallel sessions.'
Traceback (most recent call last):
File "/home/lex/local/lib/python2.7/site-packages/lettuce_webdriver/parallel_runner.py", line 157, in worker_process
failfast=self.failfast))
File "/home/lex/local/lib/python2.7/site-packages/lettuce/core.py", line 1166, in run
call_hook('before_each', 'feature', self)
File "/home/lex/local/lib/python2.7/site-packages/lettuce/registry.py", line 88, in call_hook
callback(*args, **kw)
File "/home/lex/src/deus_lex/winslow/tests/features/terrain.py", line 40, in setup_browser
secret=world.browserstack_secret,
File "/home/lex/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 71, in __init__
self.start_session(desired_capabilities, browser_profile)
File "/home/lex/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 113, in start_session
'desiredCapabilities': desired_capabilities,
File "/home/lex/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 164, in execute
self.error_handler.check_response(response)
File "/home/lex/local/lib/python2.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 164, in check_response
raise exception_class(message, screen, stacktrace)
WebDriverException: Message: u'5 sessions are currently being used. Please upgrade to add more parallel sessions.'
Traceback (most recent call last):
File "/home/lex/local/lib/python2.7/site-packages/lettuce/registry.py", line 88, in call_hook
callback(*args, **kw)
File "/home/lex/src/deus_lex/winslow/tests/features/terrain.py", line 40, in setup_browser
secret=world.browserstack_secret,
File "/home/lex/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 71, in __init__
self.start_session(desired_capabilities, browser_profile)
File "/home/lex/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 113, in start_session
'desiredCapabilities': desired_capabilities,
File "/home/lex/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 164, in execute
self.error_handler.check_response(response)
File "/home/lex/local/lib/python2.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 164, in check_response
raise exception_class(message, screen, stacktrace)
WebDriverException: Message: u'5 sessions are currently being used. Please upgrade to add more parallel sessions.'
Traceback (most recent call last):
File "/home/lex/local/lib/python2.7/site-packages/lettuce_webdriver/parallel_runner.py", line 157, in worker_process
failfast=self.failfast))
File "/home/lex/local/lib/python2.7/site-packages/lettuce/core.py", line 1166, in run
call_hook('before_each', 'feature', self)
File "/home/lex/local/lib/python2.7/site-packages/lettuce/registry.py", line 88, in call_hook
callback(*args, **kw)
File "/home/lex/src/deus_lex/winslow/tests/features/terrain.py", line 40, in setup_browser
secret=world.browserstack_secret,
File "/home/lex/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 71, in __init__
self.start_session(desired_capabilities, browser_profile)
File "/home/lex/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 113, in start_session
'desiredCapabilities': desired_capabilities,
File "/home/lex/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 164, in execute
self.error_handler.check_response(response)
File "/home/lex/local/lib/python2.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 164, in check_response
raise exception_class(message, screen, stacktrace)
WebDriverException: Message: u'5 sessions are currently being used. Please upgrade to add more parallel sessions.'
================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
Died with Message: u'5 sessions are currently being used. Please upgrade to add more parallel sessions.'
0 feature (0 passed)
0 scenario (0 passed)
0 step (0 passed)
========================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
Died with Message: u'5 sessions are currently being used. Please upgrade to add more parallel sessions.'
0 feature (0 passed)
0 scenario (0 passed)
0 step (0 passed)
========================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
Died with Message: u'5 sessions are currently being used. Please upgrade to add more parallel sessions.'
0 feature (0 passed)
0 scenario (0 passed)
0 step (0 passed)
==================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================Traceback (most recent call last):
File "/home/lex/local/lib/python2.7/site-packages/lettuce/registry.py", line 88, in call_hook
callback(*args, **kw)
File "/home/lex/src/deus_lex/winslow/tests/features/terrain.py", line 40, in setup_browser
secret=world.browserstack_secret,
File "/home/lex/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 71, in __init__
self.start_session(desired_capabilities, browser_profile)
File "/home/lex/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 113, in start_session
'desiredCapabilities': desired_capabilities,
File "/home/lex/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 164, in execute
self.error_handler.check_response(response)
File "/home/lex/local/lib/python2.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 164, in check_response
raise exception_class(message, screen, stacktrace)
WebDriverException: Message: u'5 sessions are currently being used. Please upgrade to add more parallel sessions.'
Traceback (most recent call last):
File "/home/lex/local/lib/python2.7/site-packages/lettuce_webdriver/parallel_runner.py", line 157, in worker_process
failfast=self.failfast))
File "/home/lex/local/lib/python2.7/site-packages/lettuce/core.py", line 1166, in run
call_hook('before_each', 'feature', self)
File "/home/lex/local/lib/python2.7/site-packages/lettuce/registry.py", line 88, in call_hook
callback(*args, **kw)
File "/home/lex/src/deus_lex/winslow/tests/features/terrain.py", line 40, in setup_browser
secret=world.browserstack_secret,
File "/home/lex/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 71, in __init__
self.start_session(desired_capabilities, browser_profile)
File "/home/lex/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 113, in start_session
'desiredCapabilities': desired_capabilities,
File "/home/lex/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 164, in execute
self.error_handler.check_response(response)
File "/home/lex/local/lib/python2.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 164, in check_response
raise exception_class(message, screen, stacktrace)
WebDriverException: Message: u'5 sessions are currently being used. Please upgrade to add more parallel sessions.'
======================================================================================================================================================================================================================================================================================================================================================
Died with Message: u'5 sessions are currently being used. Please upgrade to add more parallel sessions.'
0 feature (0 passed)
0 scenario (0 passed)
0 step (0 passed)
View judges for law firm ... OK
View judges for attorney ... OK
1 feature (1 passed)
2 scenarios (2 passed)
13 steps (13 passed)
Ensure Each District Court Page Renders ...
1 feature (1 passed)
92 scenarios (92 passed)
184 steps (184 passed)
Hello,
I tried modifying the "find_field_by" function to find a text field by type, and later "clear" and "send_keys" in order to fill out a form. Specifically, I'm trying to target two fields: type="email" and type="password" but I get the following error message (doesn't get past filling the e-mail field in the test):
AssertionError: And I fill in field with type "email" with "[email protected]", failed because: Message: u'Element is not currently visible and so may not be interacted with' ; Stacktrace: Method fxdriver.preconditions.visible threw an error in file:///var/folders/xo/xoXGh2V+E70Th0NlE8tkIk+++TM/-Tmp-/tmpjm7c8r/extensions/[email protected]/components/command_processor.js
This is the function I'm using to target these fields:
@step('I fill in field with type "(.?)" with "(.?)"')
def fill_in_textfield_by_type(step, field_type, value):
with AssertContextManager(step):
text_field = find_field_by_type(world.browser, field_type)
assert_false(step, text_field is False,'Can not find a field with type "%s"' % field_type)
text_field.clear()
text_field.send_keys(value)
And the "find_field_by_type" function:
def find_field_by_type(browser, attribute):
xpath = "//input[@type='%s']" % attribute
elems = browser.find_element_by_xpath(xpath)
return elems
Any suggestions on creating a function to properly target these elements and fill them out?
Thanks,
Jorge
The Selenium webdriver supports setting implicit wait timeouts when selecting elements, as described here https://code.google.com/p/selenium/wiki/RubyBindings#Timeouts
To test this, try setting
`````` world.browser.implicitly_wait(2)```
Unfortunately, several of lettuce_webdriver's steps do not use the Selenium API in a way to support this feature. In particular, all element queries and all of an element's content checks have to be sent to the selenium remote in one command.
For example, this does not work:
text not in world.browser.page_source
Additionally, queries like this create an increased slowdown:
find_field(world.browser, 'textarea', field_name) or \
find_field(world.browser, 'password', field_name)```
Since the lack of implicit waits may be a blocker for us, maybe you could give us an idea of whether you want to support it and when.
Thanks,
Robert
"I should see" should match on page title, or perhaps there should be a separate test to match on that, like "Page title should be".
There's quite a few queries in LWD which do things like:
text_field = find_field(world.browser, 'text', field_name) or \
find_field(world.browser, 'textarea', field_name) or \
find_field(world.browser, 'password', field_name) or \
...
Each one of these triggers a single XPath query to the WebDriver, which if you're using a network webdriver, such as BrowserStack, is another round-trip across the Internet.
Need to combine these into single queries to the WebDriver.
... or use a homebrew assert_true().
$ lettuce test/
Traceback (most recent call last):
File "/tmp/env/bin/lettuce", line 9, in
load_entry_point('lettuce==0.1.26', 'console_scripts', 'lettuce')()
File "/tmp/env/lib/python2.6/site-packages/lettuce/commands.py", line 69, in main
result = runner.run()
File "/tmp/env/lib/python2.6/site-packages/lettuce/init.py", line 105, in run
self.loader.find_and_load_step_definitions()
File "/tmp/env/lib/python2.6/site-packages/lettuce/fs.py", line 41, in find_and_load_step_definitions
module = import(to_load)
File "/tmp/test/terrain.py", line 3, in
import lettuce_webdriver.webdriver
File "/tmp/env/lib/python2.6/site-packages/lettuce_webdriver/webdriver.py", line 4, in
from nose.tools import assert_true
ImportError: No module named nose.tools
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.