Skip to content
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

Initial Webdriver support #305

Merged
merged 10 commits into from
Aug 26, 2021
Merged

Initial Webdriver support #305

merged 10 commits into from
Aug 26, 2021

Conversation

lauromoura
Copy link
Collaborator

These commits add the basic plumbing needed to support running WebDriver scripts with Cog. For example, opening a page, following links and sending basic mouse and keyboard commands.

Still missing some documentation and examples of using it, alongside other bits like some visual feedback that the automation mode is enabled.

On the WebKit side, some harness patch will be needed to make the webdriver tests to run with -DENABLE_COG enabled.

core/cog-shell.c Outdated Show resolved Hide resolved
core/cog-shell.c Outdated Show resolved Hide resolved
cog.c Outdated
if (s_options.automation) {
uri = "about:blank";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we just check whether CogShell object is automated? This would avoid the need for the option list entry.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checking the CogShell for automation is also possible. I've updated the patch with it.

Regarding the option list entry, I thought about it more like a way to document this flag, keeping consistent with other arguments (even though it has this special check before the application is created).

cog.c Outdated Show resolved Hide resolved
This property will be used through cog to detect whether it has been
launched in automated mode (e.g. launched from WebDriver).

The most visible changes are the "automated" property and the new
`cog_launcher_init_default(type)`, to initialize the default launcher
with the given session type. The previous `cog_launcher_get_default`
keeps the behavior of creating a non-automated launcher if none has been
created yet (unlikely to happen, though).
Just a stub and defaulting to about:blank instead of requiring an URL
explicitly.

Actual automation pumbling to be done in following commits.
Mirror of the cog-launcher one.
Actual testing with both selenium and WPT should be limited by lack of
multi view support as their fixtures rely on creating multiple views.
Usually from javascript's window.close or webkit_web_view_try_close.

This is a very basic handler. We might want to expose it to the
cog-shell API to allow the user to react to it.
Copy link
Member

@aperezdc aperezdc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modulo style checker failures, patch looks reasonable to me. You can apply locally the suggestions from the style checker doing something like this, assuming you have a local branch derived from master:

data/check-style master | git apply -p0

@aperezdc aperezdc merged commit 9da375d into Igalia:master Aug 26, 2021
@aperezdc
Copy link
Member

Thanks @lauromoura!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants