|
24 | 24 | #include "frame_path.h"
|
25 | 25 | #include "value_conversion_util.h"
|
26 | 26 | #include "webdriver_logging.h"
|
| 27 | +#include "webdriver_server.h" |
| 28 | +#include "webdriver_switches.h" |
27 | 29 |
|
28 | 30 | #include "third_party/webdriver/atoms.h"
|
29 | 31 |
|
@@ -511,6 +513,8 @@ Error* QWebkitProxy::SetActiveElement(const ElementId& element) {
|
511 | 513 | Error* QWebkitProxy::SwitchTo() {
|
512 | 514 | AddBrowserLoggerToView();
|
513 | 515 |
|
| 516 | + SetWebInspectorSupport(page_); |
| 517 | + |
514 | 518 | // reset frame path
|
515 | 519 | session_->frame_elements_.clear();
|
516 | 520 | session_->set_current_frame(FramePath());
|
@@ -1861,6 +1865,26 @@ void QWebkitProxy::AddBrowserLoggerToView() {
|
1861 | 1865 | logHandler->loadConsoleJS(page_);
|
1862 | 1866 | }
|
1863 | 1867 |
|
| 1868 | +void QWebkitProxy::SetWebInspectorSupport(QWebPage *page) |
| 1869 | +{ |
| 1870 | + page->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true); |
| 1871 | + CommandLine cmdLine = webdriver::Server::GetInstance()->GetCommandLine(); |
| 1872 | + |
| 1873 | + if (cmdLine.HasSwitch(webdriver::Switches::kWIServer)) |
| 1874 | + { |
| 1875 | + if (cmdLine.HasSwitch(webdriver::Switches::kWIPort)) |
| 1876 | + { |
| 1877 | + std::string wiPort = cmdLine.GetSwitchValueASCII(webdriver::Switches::kWIPort); |
| 1878 | + int port = QString(wiPort.c_str()).toInt(); |
| 1879 | + page->setProperty("_q_webInspectorServerPort", port); |
| 1880 | + } |
| 1881 | + else |
| 1882 | + { |
| 1883 | + page->setProperty("_q_webInspectorServerPort", 9222); |
| 1884 | + } |
| 1885 | + } |
| 1886 | +} |
| 1887 | + |
1864 | 1888 |
|
1865 | 1889 | } // namespace webdriver
|
1866 | 1890 |
|
|
0 commit comments