native methods for a browser and operating system

193 views
Skip to first unread message

Jiangfan Shi

unread,
Apr 12, 2012, 9:57:07 AM4/12/12
to Selenium Users
I know this is the advantage of WebDriver. Can anybody explain this a
little bit more?

For example, for a Alert window, when I click the ok button, is this
event a window event captured in the OS, and then this OS event is
used by WebDriver?

Thanks,

Jiangfan

Jiangfan Shi

unread,
Apr 12, 2012, 9:54:11 PM4/12/12
to Selenium Users
still need answers from experts. thanks.

Jim Evans

unread,
Apr 13, 2012, 7:12:05 AM4/13/12
to seleniu...@googlegroups.com
You've implied multiple questions but only asked one. To answer the one question you've asked, each browser implements the alert window handling slightly differently, and differently depending on the OS. Not every OS has a "new window" event you can subscribe to. Windows, for example, does not have any such thing. So alert window detection is usually based on polling the OS for open top-level windows and finding one that is of the proper class and is "owned" by the application window. This is explicitly how it's done for IE; I'm not completely sure about other browsers. Of course, all of this information is readily available, simply by looking at the source code, which is freely available, as it's an open-source project.

--Jim

Jiangfan Shi

unread,
Apr 16, 2012, 11:19:30 PM4/16/12
to Selenium Users
Jim,

Thanks for your answer for the alert window detection.

From the document in the google website of selenium, I know that the
architecture of InternetExplorerDriver is the following:

InternetExplorerDriver(Java) -> webdriver.h-> InternetExplorerDriver(C+
+)------PostMessage--->IEThreadExplorer(C++)-----COM-->IE

My question is related to the COM part. I wonder if the below
statement explains the COM correctly?

“The IE driver integrates tightly with IE by making use of the IE COM
Automation interfaces that ship with every version of Windows. In
particular, we use COM interfaces from the native MSHTML and ShDocVw
DLLs, which form part of IE.”

The statement appears in the link (http://www.aosabook.org/en/
selenium.html).

I tried to look for source code of InternetExplorerDriver, but there
are lots of layers as shown in the above arrow chain. If possible,
could you please point me to the final layer files which calls COM
directly?

Thanks a lot.

Jiangfan

Jim Evans

unread,
Apr 17, 2012, 7:53:38 AM4/17/12
to seleniu...@googlegroups.com
I rather thought we'd removed that page from the wiki. It's drastically out of date. The source code of the IE driver contains COM calls scattered throughout the code base. You should pay particular attention to Browser.cpp, Element.cpp, and the .h files in the CommandHandlers directory.

--Jim

Reply all
Reply to author
Forward
0 new messages