Skip to content

Commit c8b8f42

Browse files
committed
Merge branch '0.x' into 'master'
2 parents 48126cc + c23c1e9 commit c8b8f42

File tree

10 files changed

+983
-99
lines changed

10 files changed

+983
-99
lines changed

CHANGELOG.md

Lines changed: 54 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,73 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010

1111
- No changes yet.
1212

13+
## [0.2.0] - 2020-12-18
14+
### Added
15+
16+
- `ClientInterface::getTabIdentifiers()` method implementation (reading a list of tabs, which are opened in the
17+
browser).
18+
- Implementations for the `ClientInterface::getActiveTabIdentifier()` and `ClientInterface::setActiveTab()` commands,
19+
to determine which of the tabs is currently "focused" and to open (focus) a specific one.
20+
- `ClientInterface::openUri()` and `ClientInterface::getCurrentUri()` implementations, to open a web page
21+
in the current browser tab and read an URI from the address bar.
22+
- `ClientInterface::getSource()` for acquiring source code of the web resource that is opened in the active (focused)
23+
browser tab (view-source action).
24+
- `ClientInterface::getElementIdentifier()` to get an internal WebDriver handle of the specific element on the page.
25+
- `ClientInterface::getActiveElementIdentifier()` to get an internal handle of the currently focused element.
26+
- `ClientInterface::getElementVisibility()` to check if the target is visible on the page.
27+
- `ClientInterface::mouseMove()` and `ClientInterface::mouseLeftClick()` to perform the most common mouse actions in
28+
the browser window.
29+
- `ClientInterface::keypressElement()` to send keyboard keys to the element on the page.
30+
- `ClientInterface::getScreenshot()` and a `WebDriverInterface::saveScreenshot()` shortcut implementation, to capture
31+
a screen state of the remote browser instance.
32+
- `WebDriverInterface::wait()` and `WebDriverInterface::waitUntil()` to make delays and conditional checks
33+
(waiting for element visibility, etc.).
34+
- README: a "Requirements" block, description improvements.
35+
36+
### Changed
37+
- `Timeout\Interceptor` is now raising a single exception with both method-specific message and a timeout context.
38+
39+
### Fixed
40+
- Interface fixes and a minor redesign for some signatures.
41+
42+
This version brings an async variant for most methods (no tests yet), which were defined by the
43+
`WebDriverInterface` and `ClientInterface`, to communicate with a remote Selenium WebDriver service in non-blocking
44+
mode, except: `getSessionIdentifiers`, `removeSession` and `clickElement` commands (the last one can be supplanted
45+
by the `mouseLeftClick`, in combination with the `mouseMove` action).
46+
47+
At this moment, `ClientInterface::createSession()` is able to send only a hardcoded set of capabilities (settings
48+
for the executable file and profile preferences) to launch a browser instance (will be patched in the later versions):
49+
50+
```
51+
{
52+
"browserName": "chrome",
53+
"goog:chromeOptions": {
54+
"args": [
55+
"--user-data-dir=\u002fopt\u002fgoogle\u002fchrome\u002fprofiles"
56+
],
57+
"prefs": {
58+
"intl.accept_languages": "RU-ru,ru,en-US,en"
59+
}
60+
}
61+
}
62+
```
63+
1364
## [0.1.0] (core design) - 2020-12-02
1465
### Added
1566

1667
- `WebDriverInterface` and low-level `ClientInterface` to communicate with
1768
[Selenium Grid](https://www.selenium.dev/documentation/en/grid) server asynchronously, using the centralized
1869
[event loop](https://github.com/reactphp/event-loop) and [promise API](https://github.com/reactphp/promise).
19-
- `SeleniumHubDriver` and `Client\W3Client` stubs for W3C compliant webdriver implementation.
70+
- `SeleniumHubDriver` and `Client\W3CClient` stubs for W3C compliant webdriver implementation.
2071
- `WebDriverFactory` as a shortcut for driver instantiation.
2172
- `Timeout\Interceptor` to prevent unresolved (hanging) driver promises, whenever it fails
2273
(using [reactphp/promise-timer](https://github.com/reactphp/promise-timer)).
23-
- `ClientInterface::createSession()` method implementation (opening Selenium hub session to interact with remote
74+
- `ClientInterface::createSession()` method implementation (opening a Selenium hub session to interact with remote
2475
browser instance).
2576

2677
This early development version doesn't yet contain full implementation for the introduced `WebDriverInterface`, only
2778
core design solutions and library interfaces are defined.
2879

29-
[Unreleased]: https://github.com/itnelo/reactphp-webdriver/compare/0.1.0...0.x
80+
[Unreleased]: https://github.com/itnelo/reactphp-webdriver/compare/0.2.0...0.x
3081
[0.2.0]: https://github.com/itnelo/reactphp-webdriver/compare/0.1.0..0.2.0
3182
[0.1.0]: https://github.com/itnelo/reactphp-webdriver/releases/tag/0.1.0

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,23 @@ This is a direct port of [RemoteWebDriver](https://github.com/php-webdriver/php-
55
logic from the [php-webdriver/webdriver](https://github.com/php-webdriver/php-webdriver) package, which utilizes [ReactPHP](https://github.com/reactphp/reactphp)
66
event loop and promise API for browser interaction w/o execution flow blocking.
77

8+
**Selenium WebDriver** is a software that is used to manipulate browsers from the code (primarily, for testing and web scraping).
9+
You can find more here: [https://selenium.dev](https://selenium.dev).
10+
11+
This PHP client sends async HTTP requests to the [Grid](https://www.selenium.dev/documentation/en/grid). It is a central
12+
endpoint for commands, a bridge between your code and browser instances. See
13+
[SeleniumHQ/docker-selenium](https://github.com/SeleniumHQ/docker-selenium) to get your own remote browser (or a cluster).
14+
15+
Enjoy!
16+
17+
## Requirements
18+
19+
- **PHP 7.4** or higher.
20+
- ReactPHP v1 (http **^1**, stream **^1**).
21+
- Symfony conflicts: 5.1 (or newer) environments are preferred; the package uses (and will use) some components from
22+
there, and their code / version constraints may need a review, to include a wider range of supported environments
23+
(otherwise, you need to adjust your platform).
24+
825
## Installation
926

1027
With [composer](https://getcomposer.org/download):
@@ -72,6 +89,7 @@ $socketConnector = new SocketConnector(
7289
],
7390
);
7491
$browser = new Browser($loop, $socketConnector);
92+
$browser = $browser->withRejectErrorResponse(false);
7593

7694
$hubClient = new W3CClient(
7795
$browser,

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@
2323
"minimum-stability": "stable",
2424
"require": {
2525
"php": ">=7.4",
26-
"react/http": "^1.1",
26+
"react/http": "^1.2",
2727
"react/promise": "^2.8",
2828
"react/promise-timer": "^1.6",
29+
"react/stream": "^1.1",
2930
"symfony/options-resolver": "^5.1"
3031
},
3132
"require-dev": {

0 commit comments

Comments
 (0)