Test-friendly Python API for Selenium and integration with web application frameworks.
gocept.selenium provides an API for Selenium that is suited for writing tests and integrates this with your test suite for any WSGI, Plone or Grok application.
|Current change log:|
In order to build the Sphinx documentation, run the following command with a python, where sphinx is installed:
$ python3 -m venv . $ bin/pip install Sphinx $ bin/sphinx-build doc doc/build
The generated HTML gets stored in doc/build.
- Fix links and typos in documentation.
- Fix tests running on Google Chrome. (Issue #20)
- Google Chrome: Add temporary download directory support. It is accessible as a pathlib.Path via self.layer['selenium_download_dir'].
- Google Chrome: Add support for head mode.
- Add beta support for Microsoft Edge. (It currently supports all features besides headless mode and download directory support but is only tested using the tests of gocept.selenium. Caution: Edge does not seem to be really stable on Mac OS, after some test runs it sometimes refuses to start and requires to delete its preferences etc.)
- Add access to the selected browser and headless mode via a getitem call on the layer.
Backwards incompatible changes
- Drop support for Python 2, 3.5 and 3.6.
- Remove requirements.txt.
- Add support for Python 3.8 and 3.9.
- Firefox: Add a temporary download directory for PDF files. It is accessible as a pathlib.Path via self.layer['selenium_download_dir'].
- Delete localStorage on testTearDown of .webdriver.Layer.
- Wait for elements the time defined as timeout instead of always 5 seconds.
- Catch ElementClickInterceptedException when an element is clicked.
- Migrate to Github.
- Fix UserWarning in selenium >= 3, that screenshot name should end with .png.
Backwards incompatible changes
- Remove support for Selenium 1, in particular RCTestCase and RCLayer.
- Remove support for Selenium 2.
- Remove support for a remote selenium server. gocept.selenium now uses the local implementation, starting its own browser.
- Add support for Python 3.6 and 3.7.
- Selenium updated to version 3.
- Add firefox headless support.
- Add new defaults for gocept.selenium.webdriver.Layer.
- Add experimental support for chromedriver in headless mode only.
- Remove bootstrap.py, add requirements.txt.
- Fix more deprecation warnings.
- selenese_pattern_equals() in wd_selenese.py now returns a bool.
- Drop support for Zope 2.
- Depend on gocept.httpserverlayer >= 3.
- Depend on plone.testing >= 7.0.
- Fix deprecation warnings.
- Fix wd_selense.Selenese.selectFrame('index=0') to forward the index as number to the underlying WebDriver so it is actually treated as an index.
- Support selenium versions >= 2.53. https://bitbucket.org/gocept/gocept.selenium/issues/12
- Require a selenium version < 3.0 as this version removed the support for Selenium RC.
- Drop support for:
- zope.app.testing (extras_require: [ztk])
- Testing.ZopeTestCase (extras_require: [zope2])
- plone.app.testing (extras_require: [test_plonetestingz2])
- Products.PloneTestCase (extras_require: [plonetestcase])
- Remove the empty script extras_require.
- Drop support for Python 2.4, 2.5, 2.6. Now only supporting Python 2.7.
- Currently only supporting a selenium version < 2.53 as this version breaks using a custom Firefox. See https://github.com/SeleniumHQ/selenium/issues/1965
- Add .wd_selense.Selenese.selectParentFrame() to select the parent of a frame or an iframe.
- Fix using a local Firefox using GOCEPT_WEBDRIVER_REMOTE=False as the environment setting.
- Update tests to gocept.httpserverlayer >= 1.4.
- Add documentation for the Jenkins integration of screenshots made from test failures. (#13936)
- Webdriver: Add a loop with time-out to click in order to deal with StaleElementReferenceException and NoSuchElementException.
- Webdriver: waitFor retries an assertion when NoSuchElementException was raised. (This is useful for assertions like waitForVisible.)
- Add clear to webdriver to delete the contents of an input field.
- Write junit annotations when a screenshot was taken for assertions beside assertScreenshot(). (#13678)
- Added getCssCount and getXpathCount, so tests can get a baseline before an action.
- Fix getSelectedValue for webdriver.
- Webdriver: waitFor will now retry the assertion when StaleElementReferenceException was raised, instead of yielding the error. (This could happen for assertions like waitForAttribute, which would retrieve the DOM node and then ask for it’s attribute. Thus the node can be changed in-between, which leads to the error.)
- Improve environment variable handling implementation.
- Fix handling firefox profile in remote=false mode.
- Allow launching the browser directly when using Webdriver (set GOCEPT_WEBDRIVER_REMOTE=False and the browser name accordingly).
- Add optional movement parameter to dragAndDropToObject that moves the mouse a little before releasing the button, so one gets more realistic behaviour when needed (Webdriver only, RC does not seem to have this issue).
- Add js and jquery locators (Webdriver only).
- Fixed capitalisation of Selenese’s chooseOkOnNextConfirmation. (Backwards incompatibility should be OK as it can never have worked before, anyway.)
- No longer stop whole test run if an exception occures during testSetUp of .seleniumrc.Layer (#13375)
- Remove window.gocept_selenium_abort_all_xhr again, this solution is incomplete, since we can only inject this during open() – when the browser then navigates to a different page, the injection is lost.
- Inject JS function window.gocept_selenium_abort_all_xhr during open(), which is useful to call during test teardown to avoid spurious XHR requests to still be performed after the actual test has already ended. (Implemented in Webdriver only, but could be backported to RC if needed).
- Webdriver: Only create a firefox profile when the selected browser is firefox (#11763).
- Restore Python 2.6 compatibility of tests accidently broken in release 2.1.3.
- Adjust isElementPresent of WebDriver to work with PhantomJS, since it may raise a general WebDriverException if the element was not found.
- Webdriver: No longer screenshotting while waiting for the condition to become true when using a waitFor* method.
- Remove seleniumrc variable from Layer on teardown for symmetry.
- Fix isVisible of WebDriver, so it also returns False if a parent element is hidden.
- Close temporary files when making screenshots. This fixes some occurrences of “Too many open files”.
- Make timeout configurable via environment variable GOCEPT_SELENIUM_TIMEOUT (#10497).
- Apply setTimeout to the open() timeout, too (#10750).
- Add environment variable GOCEPT_SELENIUM_JUNIT_ATTACH to support the “JUnit Attachments Plugin” for Jenkins.
- Move instantiating Selenese object from testSetUp to layer setUp. This should not change the behaviour for clients (we take care to reset the configured timeout in testSetUp as before), but take care.
- Fix URL to GROK toolkit versions.
- Marking 2.0 stable, yay.
- Save screenshots of assertion failures with mode 644 (world-readable), which is useful for build servers.
- Implement setWindowSize for both RC and Webdriver.
- Implement getAllWindowIds in RC-Selenese.
- If a test fails because of an empty body, taking automatically a screenshot failed and concealing the original error message. This is now fixed. (#12341)
- Improved documentation, in particular with respect to the changes by integrating webdriver.
- If an AssertionError occures in a test using webdriver, a screenshot is taken automatically and the path is presented to the user. (#12247)
- Made a test for assertScreenshot pass on systems with a different browser default font.
- Stabilize webdriver/selenese API functions waitForPageToLoad() and isTextPresent to not raise errors when the elements vanish in between.
- Extract StaticFilesLayer to gocept.httpserverlayer.
- Added assertScreenshot to visually compare rendered elements with a master screenshot.
- Add layer that uses Webdriver as the Selenium backend instead of the old Remote Control.
- Fix: Initialise the WSGI layer in the correct order to actually allow the configured WSGI app to be remembered.
- Fix: updated some imports after the extraction of gocept.httpserverlayer.
- Update StaticFilesLayer to the new httpserverlayer API.
- Extract HTTP server integration into separate package, gocept.httpserverlayer
- Marking the API as stable.
- Added gocept.selenium.skipUnlessBrowser decorator to skip tests unless ceratins browser requirements are met.
- Fix: The static test server did not shutdown in some situations.
- Fixed selenese popup tests.
- Open a random port for the server process by default: When the environment variable GOCEPT_SELENIUM_APP_PORT is not set, a random free port is bound. This allows parallel testing, for instance (#11323).
- API expansion: Added assertCssCount. Thus requiring selenium >= 2.0.
- Added Trove classifiers to package metadata.
- Moved code to Mercurial.
- Fixed WSGI flavor: There was a RuntimeError in tear down if the WSGI server was shut down correctly.
- Updated URL of bug tracker.
- script extra no longer requires elementtree on Python >= 2.5.
- Added a selenese assert type ‘list’ and added it to the window management query methods.
- API expansion: added openWindow.
- API change: filter the result of getAllWindowNames to ignore ‘null’.
- backwards-compatible API change: selectWindow now selects the main window also when passed the window id None or no argument at all.
- pinned compatible ZTK version to 1.0.1, grok version to 1.2.1, generally pinned all software packages used to consistent versions for this package’s own testing
- API expansion: added getAllWindow* and selectWindow.
- Added some notes how to test a Zope 2 WSGI application.
- Described how to test a Zope 2/Plone application if using plone.testing to set up test layers.
- Improvements on the README.
- Wrote a quick start section for packages using ZTK but using zope.app.wsgi.testlayer instead of zope.app.testing.
- Allowed to use regexp as pattern prefix for regular expressions additionally to regex to be compatible with the docstring and the Selenium documentation.
- Script that generates python tests from Selenium HTML tables. Reused from KSS project, courtesy of Jeroen Vloothuis, original author.
- Using a URL of Selenium RC in README where version 1.0.3 can be downloaded (instead of 1.0.1) which works fine with Firefox on Mac OS X, too.
- Provide integration with the recent testlayer approach (zope.app.appsetup/zope.app.wsgi) used by Grok (#8260).
- Provide integration with plone.testing
- Make browser and RC server configurable (#6484).
- Show current test case in command log (#7876).
- Raise readable error when connection to RC server fails (#6489).
- Quit browser when the testrunner terminates (#6485).
- Fixed tests for the StaticFilesLayer to pass with Python 2.4 through 2.7.
- API expansion: getSelectOptions
- API expansion: getElementHeight|Width, getCookie* and a few others.
- lots of action methods (mouse* among others)
- assertXpathCount now also takes ints (#7681).
- API expansion: add isChecked to verify checkboxes, runScript, clickAt, getLocation, getSelectedValue, getSelectedIndex.
- The pause method uses float division now. Pauses where implicitly rounded to full seconds before when an int was passed.
- The name of the factored test layer contains the module of the bases now. The name is used by zope.testrunner distinguish layers. Before this fix selenium layers factored from base layers with the same names but in different modules would be considered equal by zope.testrunner.
- The factored ZTK layer cleanly shuts down the http server in tearDown now. This allows to run different selenium layers in one go.
- Add a static files test layer for running selenium tests against a set of static (HTML) files.
- Patterns now also work with multiline strings, i. e. ‘foo*’ will match ‘foonbar’ (#7790).
- API expansion: *keyDown, *keyUp, keyPress.
- API expansion: added getSelectedLabel.
- Ignore the code of a server’s response when calling open. The default behaviour of SeleniumRC changed between 1.0.1 and 1.0.2 but we want the old behaviour by default.
- API expansion: add getLocation to retrieve currently loaded URL in browser.
- API expansion: added waitForPopUp, selectPopUp, deselectPopUp and close.
- API expansion: added verifyAlertPresent, verifyAlertNotPresent and waitForAlertPresent.
- Usability: raise a better readable exception when an unimplemented selenese method is called.
- Usability: raise failure exceptions that convey the name of the failed assertion in spite of some lambdas wrapped around it.
- Extracted ‘host’ and ‘port’ as class attributes of gocept.selenium.ztk.Layer so subclasses can override them; stopped hardcoding 8087 as the server port.
- Fix incomplete sdist release on PyPI.
- Make Zope 2 test server reachable from the outside.
- Implemented getTitle/assertTitle/waitForTitle/etc.
- first release
Release history Release notifications | RSS feed
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size gocept.selenium-6.1-py3-none-any.whl (86.1 kB)||File type Wheel||Python version py3||Upload date||Hashes View|
|Filename, size gocept.selenium-6.1.tar.gz (106.6 kB)||File type Source||Python version None||Upload date||Hashes View|
Hashes for gocept.selenium-6.1-py3-none-any.whl