Jump to content

Changing icon of "running" Chrome webdriver.

Recommended Posts

Posted (edited)

This works for me, resulting array contains hWnd and PID to chose from.

#include <Array.au3>
#include <WinAPI.au3>

$a_hWnd_Chrome = WinList("[Class:Chrome_WidgetWin_1]")

If $a_hWnd_Chrome[0][0] = 0 Then Exit 123 ; no chrome window found

ReDim $a_hWnd_Chrome[UBound($a_hWnd_Chrome)][3]
For $i = 1 To $a_hWnd_Chrome[0][0]
    $a_hWnd_Chrome[$i][2] = WinGetProcess($a_hWnd_Chrome[$i][1])

For $i = 32512 To 32518 ; $IDI_APPLICATION to $IDI_SHIELD as defined in AutoItConstants.au3
    $hIcon = _WinAPI_LoadIconWithScaleDown(0, $i, 16, 16)
    $hIcon_orig = _SendMessage($a_hWnd_Chrome[1][1], 0x0080, 1, $hIcon) ; WM_SETICON = 0x0080


P.S.: It seems that the chrome windows all share the same host process, so you'll have to chose by window hwnd or title. Maybe track which hwnd exist and chose different icon for new hwnds?

Edited by KaFu
Link to post
Share on other sites

@KaFuCame to the same conclusion. And without analyzing you code , I came  up with the same idea of using Winlist 😀

For the time being this solution is working for me. Alas, wrote I was using Chrome, but actually I was using Chromedriver which starts an instance of Chrome.
I have ask the question in DanP2's Webdriver thread, if it's possibe to obtain the PID or WInHandle direcly from the webdriver when it starts the browser.

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...