Skip to content

Commit 3edf50e

Browse files
Andrii BoichukAndrii Boichuk
authored andcommitted
Merge branch 'WD_1.X_dev' of https://portal-ua.globallogic.com/git/wd into WD_1.X_dev
2 parents 716fc34 + 097d34f commit 3edf50e

File tree

1 file changed

+2
-34
lines changed

1 file changed

+2
-34
lines changed

src/webdriver/extension_qt/qml_web_view_executor.cc

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,6 @@ void QmlWebViewCmdExecutor::GetSource(std::string* source, Error** error) {
190190
void QmlWebViewCmdExecutor::SendKeys(const string16& keys, Error** error) {
191191
CHECK_VIEW_EXISTANCE
192192

193-
QDeclarativeItem* pFocusItem = qobject_cast<QDeclarativeItem*>(container_->scene()->focusItem());
194-
195193
std::string err_msg;
196194
std::vector<QKeyEvent> key_events;
197195
int modifiers = Qt::NoModifier;
@@ -207,25 +205,11 @@ void QmlWebViewCmdExecutor::SendKeys(const string16& keys, Error** error) {
207205
return;
208206
}
209207

210-
// set focus to element
211-
view_->setFocus(true);
212-
if (!view_->hasFocus()) {
213-
// restore old focus
214-
if (NULL != pFocusItem) pFocusItem->setFocus(true);
215-
216-
*error = new Error(kInvalidElementState);
217-
return;
218-
}
219-
220208
std::vector<QKeyEvent>::iterator it = key_events.begin();
221209
while (it != key_events.end()) {
222-
qApp->sendEvent(container_, &(*it));
210+
qApp->sendEvent(view_->page(), &(*it));
223211
++it;
224212
}
225-
226-
// restore old focus
227-
if (NULL != pFocusItem)
228-
pFocusItem->setFocus(true);
229213
}
230214

231215
void QmlWebViewCmdExecutor::SendKeys(const ElementId& element, const string16& keys, Error** error) {
@@ -270,27 +254,11 @@ void QmlWebViewCmdExecutor::SendKeys(const ElementId& element, const string16& k
270254
return;
271255
}
272256

273-
QDeclarativeItem* pFocusItem = qobject_cast<QDeclarativeItem*>(container_->scene()->focusItem());
274-
275-
// set focus to element
276-
view_->setFocus(true);
277-
if (!view_->hasFocus()) {
278-
// restore old focus
279-
if (NULL != pFocusItem) pFocusItem->setFocus(true);
280-
281-
*error = new Error(kInvalidElementState);
282-
return;
283-
}
284-
285257
std::vector<QKeyEvent>::iterator it = key_events.begin();
286258
while (it != key_events.end()) {
287-
qApp->sendEvent(container_, &(*it));
259+
qApp->sendEvent(view_->page(), &(*it));
288260
++it;
289261
}
290-
291-
// restore old focus
292-
if (NULL != pFocusItem)
293-
pFocusItem->setFocus(true);
294262
}
295263

296264
void QmlWebViewCmdExecutor::MouseDoubleClick(Error** error) {

0 commit comments

Comments
 (0)