Use the first created webview for webkit2gtk automation callbacks #383
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What kind of change does this PR introduce? (check at least one)
Does this PR introduce a breaking change? (check one)
The PR fulfills these requirements:
fix: #xxx[,#xxx]
, where "xxx" is the issue number)If adding a new feature, the PR's description includes:
Other information:
This is the real fix for #379. A reference to the webview passed in the automation callback is the default webview (called window in WebDriver world) that gets attached when connected to the application from a WebDriver server. With the previous partial fix, you could find the actual window and switch to it, but this fix makes it that the first created webview is the default window that is attached to. This is the same behavior as before the WebContext changes in #359 which allowed multi-window to work with WebDriver.
I checked this with Selenium and WebdriverIO on Linux. Using https://github.com/chippers/hello_tauri. Recreate the steps by building
cargo b --release && cd webdriver && yarn && yarn workspaces run test
. That should build everything then run both the Selenium and WebdriverIO tests against the example application using thiswry
branch.I also successfully tested single and multi-window WebDriver tests from my mini-scripts available at https://gist.github.com/chippers/db4305dac38e53399ee6775d6380b31a.
main.js
is for testingdetect_js_ecma
andmulti.js
is formulti_window
. Note that you need to add something liketo enable the automation on those two examples when testing them.