|
sfcode
An Online Competing and Development Environment
|
remote.DriverService#kill()selenium-webdriver/firefox.Options:selenium-webdriver/firefox/binary.Binaryselenium-webdriver/firefox.Options#useGeckoDriver()selenium-webdriver/firefox/profile.decode()selenium-webdriver/firefox/profile.Profile that had no effect since support for the legacy FirefoxDriver was dropped in 3.5.0:selenium-webdriver/firefox.ServiceBuilder#setFirefoxBinary(); custom binaries should be configured through the firefox.Options class.selenium-webdriver/firefox.Capability. These hold overs from the legacy FirefoxDriver are no longer supported.error.ElementNotVisibleError in favor of the more generic error.ElementNotInteractableError.httpOnly option when adding a cookie.Native support for Firefox 45 (ESR) has been removed. Users will have to connect to a remote Selenium server that supports Firefox 45.
SELENIUM_MARIONETTE enviornment variable no longer has an effect.selenium-webdriver/firefox.Capability.MARIONETTE is deprecated.selenium-webdriver/firefox.Options#useGeckoDriver() is deprecated and now a no-op.firefox.Options will no longer discard the "moz:firefoxOptions" set in user provided capabilities (via Builder.withCapabilities({})). When both are used, the settings in firefox.Options will be applied last.chrome.Options#headless() and chrome.Options#windowSize(), which may be used to start Chrome in headless mode (requires Chrome 59+) and to set the initial window size, respectively.error.WebDriverError#remoteStacktrace to capture the stacktrace reported by a remote WebDriver endpoint (if any).WebElement#sendKeys to send text as a string instead of an array of strings.This release requires geckodriver 0.15.0 or newer.
Options#getTimeouts() for retrieving the currently configured session timeouts (i.e. implicit wait). This method will only work with W3C compatible WebDriver implementations.Timeouts class in favor of Options#setTimeouts(), which supports setting multiple timeouts at once.value key.JAVA_HOME environment variable is set, use it to locate java.exe.lib package is once again platform agnostic (excluding lib/devmode).promise.when(value, callback, errback). Use promise.fulfilled(value).then(callback, errback)promise.fulfilled(value), promise.rejected(reason) and promise.defer() to all use native promises when the promise manager is disabled.selenium-webdriver/testing to export describe.only along with describe.skip.selenium-webdriver/lib/until.ableToSwitchToFrame. It was previously dropping arguments and would never work.promise.fulfilled(value), use promise.Promise#resolve(value)promise.rejected(reason), use promise.Promise#reject(reason)wait() condition times out, the returned promise will now be rejected with an error.TimeoutError instead of a generic Error object.WebDriver#wait() will now throw a TypeError if an invalid wait condition is provided.Removed support for the SafariDriver browser extension. This has been replaced by Apple's safaridriver, which is included wtih Safari 10 (available on OS X El Capitan and macOS Sierra).
To use Safari 9 or older, users will have to use an older version of Selenium.
selenium-webdriver/testing when users create a cycle with mocha by running with mocha's --hook flag.WebDriver.switchTo().activeElement() to use the correct HTTP method for compatibility with the W3C spec.selenium-webdriver/firefox module to use geckodriver's "moz:firefoxOptions" dictionary for Firefox-specific configuration values.selenium-webdriver/testing module to support tests defined using generator functions.SELENIUM_PROMISE_MANAGER=0. This is part of a larger plan to remove the promise manager, as documented at https://github.com/SeleniumHQ/selenium/issues/2969WebElement.getAttribute() and WebElement.isDisplayed() commands. This behavior is consistent with the java, .net, python, and ruby clients.safari.Options#useLegacyDriver()promise.Thenable for compatibility with native promises:#isPending()#cancel()#finally()webdriver.WebDriver to overload the static function WebDriver.createSession() instead of doing work in the constructor. All constructors now inherit the base class' function signature. Users are still encouraged to use the Builder class instead of creating drivers directly.Builder#build() now returns a "thenable" WebDriver instance, allowing users to immediately schedule commands (as before), or issue them through standard promise callbacks. This is the same pattern already employed for WebElements.Builder#buildAsync() as it was redundant with the new semantics of build().firefox.ServiceBuilder class, which may be used to customize the geckodriver used for firefox.Driver instances.safari.Options#useLegacyDriver, to use the safari extension driver.lib/proxy module to support configuring a SOCKS proxy.promise.ControlFlow, fire the "uncaughtException" event in a new turn of the JS event loop. As a result of this change, any errors thrown by an event listener will propagate to the global error handler. Previously, this event was fired with in the context of a (native) promise callback, causing errors to be silently suppressed in the promise chain.remote.DriverService.Builder as a base class for configuring DriverService instances that run in a child-process. The chrome.ServiceBuilder, edge.ServiceBuilder, and opera.ServiceBuilder classes now all extend this base class with browser-specific options.usingPort and withEnvironment to setPort and setEnvironment, respectively.chrome.ServiceBuilder#setUrlBasePath to #setPathfirefox.Driver from (config, flow, executor) to (config, executor, flow).Condition and WebElementCondition classes from the top-level selenium-webdriver module (these were previously only available from lib/webdriver).builder.Builder class into the main module (selenium-webdriver).builder module.webdriver.WebDriver#setFileDetector when driving Chrome or Firefox on a remote machine.builder.Builder#usingHttpAgent()until.urlIs(), until.urlContains(), until.urlMatches()http.Executor now accepts a promised client. The builder.Builder class will now use this instead of a command.DeferredExecutor when creating WebDriver instances.builder.Builder class will always return an instanceof chrome.Driver and firefox.Driver, respectively, even when configured to use a remote server (from builder.Builder#usingServer(url), SELENIUM_REMOTE_URL, etc).promise.Deferred is no longer a thenable object.Options#addCookie() now takes a record object instead of 7 individual parameters. A TypeError will be thrown if addCookie() is called with invalid arguments.firefox.Options#useMarionette to firefox.Options#useGeckoDriverselenium-webdriver/error (use selenium-webdriver/lib/error,\ or the error property exported by selenium-webdriver)selenium-webdriver/executors — this was not previously deprecated, but is no longer used.command.DeferredExecutor — this was not previously deprecated, but is no longer used. It can be trivially implemented by clients should it be needed.error.InvalidSessionIdError (use error.NoSuchSessionError)executors.DeferredExecutoruntil.Condition (use webdriver.Condition)until.WebElementCondition (use webdriver.WebElementCondition)webdriver.UnhandledAlertError (use error.UnexpectedAlertOpenError)Deferred#cancel()Deferred#catch()Deferred#finally()Deferred#isPending()Deferred#then()Promise#thenCatch()Promise#thenFinally()WebDriver#isElementPresent()WebElement#getInnerHtml()WebElement#getOuterHtml()WebElement#getRawId()WebElement#isElementPresent()WebDriverError#codeio.exists() to return a rejected promise if the input path is not a stringPromise#thenFinally() - use Promise#finally(). The thenFinally shim added to the promise module in v2.53.0 will be removed in v3.0 Sorry for the churn!WebDriver.attachToSessionremote.FileDetector will ignore paths that refer to a directory.firefox.Options#useMarionette, or by setting the SELENIUM_MARIONETTE environment variable.command.Executor implementations.For consistency with the other Selenium language bindings, WebDriver#isElementPresent() and WebElement#isElementPresent() have been deprecated. These methods will be removed in v3.0. Use the findElements command to test for the presence of an element:
driver.findElements(By.css('.foo')).then(found => !!found.length);
error.InvalidSessionIdError in favor of error.NoSuchSessionError.error module to lib/error so all core modules are co-located. The top-level error module will be removed in v3.0.until.Condition and until.WebElementCondition to the webdriver module to break a circular dependency.WebElement#getInnerHtml() and WebEleemnt#getOuterHtml()Promise#thenCatch() - use Promise#catch() insteadPromise#thenFinally() - use promise.thenFinally() insteadio.findInPath() will no longer match against directories that have the same basename as the target file.phantomjs.Driver now takes a third argument that defines the path to a log file to use for the phantomjs executable's output. This may be quickly set at runtime with the SELENIUM_PHANTOMJS_LOG environment variable.element.sendKeys(...) to send the key sequence as an array where each element defines a single key. The legacy wire protocol permits arrays where each element is a string of arbitrary length. This change is solely at the protocol level and should have no user-visible effect.Starting with v2.52.0, each release of selenium-webdriver will support the latest minor LTS and stable Node releases. All releases between the LTS and stable release will have best effort support. Further details are available in the selenium-webdriver package README.
webdriver.Builder#buildAsync(), which returns a promise that will be fulfilled with the newly created WebDriver instance once the associated browser has been full initialized. This is purely a convenient alternative to the existing build() method as the WebDriver class will always defer commands until it has a fully created browser.firefox.Profile#setHost() which may be used to set the host that the FirefoxDriver's server listens for commands on. The server uses "localhost" by default.promise.Promise#catch() for API compatibility with native Promises. promise.Promise#thenCatch() is not yet deprecated, but it simply delegates to catch.io operations to use native promises.command.Executor#execute() and HttpClient#send() to return promises instead of using callback passing.Serializable class with an internal, Symbol-defined method.Capabilities class to extend the native Map type.Capabilities.has(key) to only test if a capability has been set (Map semantics). To check whether the value is true, use get(key).executors.DeferredExecutor in favor of lib/command.DeferredExecutor.error module to export an Error subtype for each type of error defined in the W3C WebDriver spec.http.Request and http.Response classes to store headers in maps instead of object literals.ws dependency to version 1.0.1.testing/assert module.By locators that are not in the W3C spec to delegated to using CSS selectors: By.className, By.id, By.name, and By.tagName.WebElement#takeScreenshot().promises-aplus-tests compliance test suite that were fixed in version 2.1.1.webdriver.promise.ControlFlow now has a consistent execution order for tasks/callbacks scheduled in different turns of the JS event loop. Refer to the webdriver.promise documentation for more details.FIXED: a single firefox.Binary instance may be used to configure and launch multiple FirefoxDriver sessions.
var binary = new firefox.Binary(); var options = new firefox.Options().setBinary(binary); var builder = new Builder().setFirefoxOptions(options);
var driver1 = builder.build(); var driver2 = builder.build();
loopback option to remote/SeleniumServer. When set, the server will be accessed using the current host's loopback address.This is the last release for selenium-webdriver that will support ES5. Subsequent releases will depend on ES6 features that are enabled by default in Node v4.0.0. Node v0.12.x will continue to be supported, but will require setting the --harmony flag.
ws dependency from 0.7.1 to 0.8.00.10.x to 0.12.x. This is in accordance with the Node support policy established in v2.45.0.until.elementLocated() and until.elementsLocated().webdriver.logging module. For usage, see example/logging.js.Builder#usingWebDriverProxy() for more info.ErrorCode.NO_MODAL_DIALOG_OPEN and ErrorCode.MODAL_DIALOG_OPENED. Use ErrorCode.NO_SUCH_ALERT and ErrorCode.UNEXPECTED_ALERT_OPEN, respectively.promise.ControlFlow will maintain state for promise chains generated in a loop.promise.ControlFlow#wait() now has consistent semantics for an omitted or 0-timeout: it will wait indefinitely.remote.DriverService#start() will now fail if the child process dies while waiting for the server to start accepting requests. Previously, start would continue to poll the server address until the timeout expired.-silent flag to preheat the profile. Starting with Firefox 38, this would cause the browser to crash. This step, which was first introduced for Selenium's java client back with Firefox 2, no longer appears to be required.firefox.Driver#quit() will wait for the Firefox process to terminate before deleting the temporary webdriver profile. This eliminates a race condition where Firefox would write profile data during shutdown, causing the rm -rf operation on the profile directory to fail.chrome.Options API to cover all configuration options (e.g. mobile emulation and performance logging) documented on the ChromeDriver project site.Starting with the 2.45.0 release, selenium-webdriver will support the last two stable minor releases for Node. For 2.45.0, this means Selenium will support Node 0.10.x and 0.12.x. Support for the intermediate, un-stable release (0.11.x) is "best-effort". This policy will be re-evaluated once Node has a major version release (i.e. 1.0.0).
0.10.x.promise module is now Promises/A+ compliant. The biggest compliance change is that promise callbacks are now invoked in a future turn of the JS event loop. For example: var promise = require('selenium-webdriver').promise;
console.log('start');
promise.fulfilled().then(function() {
console.log('middle');
});
console.log('end');
// Output in selenium-webdriver@2.44.0
// start
// middle
// end
//
// Output in selenium-webdriver@2.45.0
// start
// end
// middle
The promise.ControlFlow class has been updated to track the asynchronous breaks required by Promises/A+, so there are no changes to task execution order.From: prefix (if it is an Error object). For example: var driver = new webdriver.Builder().forBrowser('chrome').build();
driver.get('http://www.google.com/ncr');
driver.call(function() {
driver.wait(function() {
return driver.isElementPresent(webdriver.By.id('not-there'));
}, 2000, 'element not found');
});
This code will fail an error like: Error: element not found
Wait timed out after 2002ms
at <stack trace>
From: Task: element not found
at <stack trace>
From: Task: WebDriver.call(function)
at <stack trace>
promise.ControlFlow#getSchedule. This function now accepts a boolean to control whether the returned string should include the stacktraces for when each task was scheduled.promise.ControlFlow#getHistory, promise.ControlFlow#clearHistory, and promise.ControlFlow#annotateError. These functions were all intended for internal use and are no longer necessary, so they have been made no-ops.WebDriver.wait() may now be used to wait for a promise to resolve, with an optional timeout. Refer to the API documentation for more information.sendKeys to test file uploads. Refer to the API documentation for more information. Sample usage included in test/upload_test.jsWebDriver.touchActions().firefox.Driver will delete its temporary profile on quit.executePhantomJS (requires PhantomJS 1.9.7 or GhostDriver 1.1.0).executeScript, it defines additional properties (required by the driver's implementation). These properties will no longer be enumerable and should be omitted (i.e. they won't show up in JSON.stringify output).until module, which defines common explicit wait conditions. Sample usage: var firefox = require('selenium-webdriver/firefox'),
until = require('selenium-webdriver/until');
var driver = new firefox.Driver();
driver.get('http://www.google.com/ncr');
driver.wait(until.titleIs('Google Search'), 1000);
Builder.forBrowser() now accepts an empty string since some WebDriver implementations ignore the value. A value must still be specified, however, since it is a required field in WebDriver's wire protocol.stacktrace module will not modify stack traces if the initial parse fails (e.g. the user defined Error.prepareStackTrace)until) that defines several common conditions for use with explicit waits. See updated examples for usage.Builder.usingServer(url) once again returns this for chaining.ControlFlow#execute and ControlFlow#wait. For more information, see documentation on webdriver.promise.consume. Requires harmony support (run with node --harmony-generators in v0.11.x).Builder API. Notably, the build() function will no longer default to attempting to use a server at http://localhost:4444/wd/hub if it cannot start a browser directly - you must specify the WebDriver server with usingServer(url). You can also set the target browser and WebDriver server through a pair of environment variables. See the documentation on the Builder constructor for more information.var webdriver = require('selenium-webdriver')
chrome = require('selenium-webdriver/chrome');
// The following are equivalent.
var driver1 = new webdriver.Builder().forBrowser('chrome').build();
var driver2 = new chrome.Driver();
UnhandledAlertError#getAlert and added #getAlertText. getAlert will be removed in 2.45.0.ErrorCode.NO_MODAL_DIALOG_OPEN and ErrorCode.MODAL_DIALOG_OPENED in favor of the new ErrorCode.NO_SUCH_ALERT and ErrorCode.UNEXPECTED_ALERT_OPEN, respectively.this.timeout(ms).net.getLoopbackAddress on Windowsdone callback in Mocha's BDD interfacePromise#thenFinally should not suppress original errorPromise#addCallback(), Promise#addCallbacks(), Promise#addErrback(), and Promise#addBoth().this for Mocha tests.promise.all, promise.map, and promise.filterPromise#thenCatch() and Promise#thenFinally().Promise#addCallback(), Promise#addCallbacks(), Promise#addErrback(), and Promise#addBoth().webdriver.WebDriver#getCapability.webdriver.promise.Deferred#cancel() to silently no-op if the deferred has already been resolved.webdriver.WebElement#getAttributejvmArgs option.selenium-webdriver/testing/assert module. This module simplifies writing assertions against promised values (see example in module documentation).webdriver.Capabilities class.Builder, requesting chrome without specifying a remote server URL will default to the native ChromeDriver implementation. The ChromeDriver server must be downloaded separately. // Will start ChromeDriver locally.
var driver = new webdriver.Builder().
withCapabilities(webdriver.Capabilities.chrome()).
build();
// Will start ChromeDriver using the remote server.
var driver = new webdriver.Builder().
withCapabilities(webdriver.Capabilities.chrome()).
usingServer('http://server:1234/wd/hub').
build();
selenium-webdriver/test/proxy_test.SeleniumServer to SeleniumServer(jar, options).README.md for execution instructionswebdriver.Deferred#resolve and webdriver.promise.resolved functions.portprober.findFreePort()selenium-webdriver/testing package, which provides a basic framework for writing tests using Mocha. See selenium-webdriver/example/google_search_test.js for usage.npm install selenium-webdriver