[webkit-changes] [WebKit/WebKit] b09419: [Win] Enable WebDriver automation with wincairo as...

Haruhisa SHIN noreply at github.com
Thu Feb 15 13:51:58 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: b09419cb34e8d64bd7f0bebd59156e46cfc97a48
      https://github.com/WebKit/WebKit/commit/b09419cb34e8d64bd7f0bebd59156e46cfc97a48
  Author: Haruhisa SHIN <haruhisa.shin at open-tec.co.jp>
  Date:   2024-02-15 (Thu, 15 Feb 2024)

  Changed paths:
    M Source/WebDriver/socket/SessionHostSocket.cpp
    M Source/WebKit/PlatformWin.cmake
    M Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp
    A Source/WebKit/UIProcess/Automation/win/WebAutomationSessionWin.cpp
    M Source/WebKit/UIProcess/WebProcessPool.cpp
    M Source/WebKit/UIProcess/WebProcessPool.h
    A Source/WebKit/UIProcess/win/AutomationClientWin.cpp
    A Source/WebKit/UIProcess/win/AutomationClientWin.h
    M Source/WebKit/UIProcess/win/WebProcessPoolWin.cpp
    M Source/cmake/OptionsWin.cmake
    M Tools/MiniBrowser/win/WebKitBrowserWindow.cpp
    M Tools/MiniBrowser/win/WebKitBrowserWindow.h

  Log Message:
  -----------
  [Win] Enable WebDriver automation with wincairo as client
https://bugs.webkit.org/show_bug.cgi?id=198055

Reviewed by Fujii Hironori.

Allows UIProcess of wincairo to be controlled by WebDriver.

Page transitions, manipulation of elements, and keyboard/mouse
insteractions are possible.
Some functions are not yet supported.
Especially, the feature to handle multiple windows is not available
due to the specification that socket port RemoteInspector can only
handle one client.
WebProcessPool for automation is limited to the first created one.

Also, until now, automation has been started on MainThread
and terminated on WorkerThread of the socket.
To avoid assertion fail by canSafelyBeUsed() of WeakRef,
changed the termination process to be performed on MainThread.

How to use:
1. launch MiniBrowser.exe with environment variable WEBKIT_INSPECTOR_SERVER.
> set WEBKIT_INSPECTOR_SERVER=127.0.0.1:1641
> WebKitBuild\Release\bin64\MiniBrowser.exe

2. launch WebDriver.exe on another console.
> WebKitBuild\Release\bin64\WebDriver.exe -t 127.0.0.1:1641 -p 12345

Then you would be able to use WebDriver by sending commands to
url "http://127.0.0.1:12345".

If you use Selenium, you could navigate your browser
with a script like the following:

```
from selenium import webdriver

options = webdriver.WebKitGTKOptions()
driver = webdriver.Remote(
    command_executor="http://{0}:{1}".format('127.0.0.1', 12345),
    options=options
)

try:
    driver.get('https://docs.webkit.org/Ports/WindowsPort.html')
finally:
    driver.quit()
```

* Source/WebDriver/socket/SessionHostSocket.cpp:
* Source/WebKit/PlatformWin.cmake:
* Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp:
* Source/WebKit/UIProcess/Automation/win/WebAutomationSessionWin.cpp: Added.
* Source/WebKit/UIProcess/WebProcessPool.cpp:
* Source/WebKit/UIProcess/WebProcessPool.h:
* Source/WebKit/UIProcess/win/AutomationClientWin.cpp: Added.
* Source/WebKit/UIProcess/win/AutomationClientWin.h: Added.
* Source/WebKit/UIProcess/win/WebProcessPoolWin.cpp:
* Source/cmake/OptionsWin.cmake:
* Tools/MiniBrowser/win/WebKitBrowserWindow.cpp:
* Tools/MiniBrowser/win/WebKitBrowserWindow.h:

Originally-landed-as: 274530 at main (db706f64b581). https://bugs.webkit.org/show_bug.cgi?id=198055
Canonical link: https://commits.webkit.org/274762@main




More information about the webkit-changes mailing list