Skip to content

Commit 43568e1

Browse files
committed
changed behavior WD to check 'reuse_ui' of current session when create new one
1 parent 7ec4eed commit 43568e1

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

inc/webdriver_capabilities_parser.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@ There are two capabilities which define strategy what view will be current after
77
- "windowsize" - HWD will be try create window with given size, as a string (e.g. - "600, 600")
88
- "windowposition" - HWD will be try start window with desired position, as a string (e.g. - "80, 60")
99
- "maximize" - HWD will be try start window with maximum size
10-
- "reuseUI" - HWD checks it of prev session, if those caps not specified,
10+
- "reuseUI" - HWD checks this caps, if it is not specified,
1111
in case of attempt to create second session we get exeception of "one session only",<br/>
12-
otherwise first session will be terminated without closing windows and new session can reuse that windows
13-
12+
otherwise prev session will be terminated without closing windows and new session can reuse those windows
1413
1514
For browserClass customizer can define some generic classes. In example in default
1615
QT extension there is handling of "WidgetView" and "WebView" values for this capability.

src/webdriver/commands/create_session.cc

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,13 @@ void CreateSession::ExecutePost(Response* const response) {
4949
// session map can consist only single session at the moment
5050
Session* prev_session = sessionMap.begin()->second;
5151
bool reuse_ui;
52-
prev_session->capabilities().caps->GetBoolean(Capabilities::kReuseUI, &reuse_ui);
52+
if (required_caps_dict) {
53+
if (!required_caps_dict->GetBoolean(Capabilities::kReuseUI, &reuse_ui))
54+
desired_caps_dict->GetBoolean(Capabilities::kReuseUI, &reuse_ui);
55+
} else {
56+
desired_caps_dict->GetBoolean(Capabilities::kReuseUI, &reuse_ui);
57+
}
58+
5359
if (reuse_ui) {
5460
prev_session->Terminate();
5561
} else {

src/webdriver/webdriver_session.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@ bool Session::InitActualCapabilities() {
101101

102102
bool reuse_ui;
103103
if (required_caps_.get()) {
104-
required_caps_->GetBoolean(Capabilities::kReuseUI, &reuse_ui);
104+
if (!required_caps_->GetBoolean(Capabilities::kReuseUI, &reuse_ui))
105+
desired_caps_->GetBoolean(Capabilities::kReuseUI, &reuse_ui);
105106
} else if (desired_caps_.get()) {
106107
desired_caps_->GetBoolean(Capabilities::kReuseUI, &reuse_ui);
107108
} else {

0 commit comments

Comments
 (0)