Jump to content

IE click google div (button)


Go to solution Solved by bogQ,

Recommended Posts

2013-06-20_1355.PNG5645468754.PNGIf you can tell I have been trying to interact with some google divs that have roles like buttons but so far my trys have yeilded no results. Here is what I have done...

$create = _IEGetObjByClass($googledoc, "goog-inline-block jfk-button jfk-button-primary goog-toolbar-item-new")
_IEAction($create, "focus")

$create.fireEvent("onmousedown")
Sleep(500)
$create.fireEvent("onmouseup")
_IEAction($create, "click")

IS there something I am missing? Please any comments are welcome.

Edited by uncommon

No problem can withstand the assault of sustained thinking.Voltaire

_Array2HTMLTable()_IEClassNameGetCollection()_IEquerySelectorAll()

Link to comment
Share on other sites

where is $create defined

(read like eddie murphy in coming to america...waiter, try my soup)

Sorry it should have been

$create = _IEGetObjByClass($googledoc, "goog-inline-block jfk-button jfk-button-primary goog-toolbar-item-new")

No problem can withstand the assault of sustained thinking.Voltaire

_Array2HTMLTable()_IEClassNameGetCollection()_IEquerySelectorAll()

Link to comment
Share on other sites

I have not tested it yet, but this may help.

 

'?do=embed' frameborder='0' data-embedContent>>

I could get that UDF to work, looks through some of the fuctions. I think it was mostly using _IEgetobjectbyID () that does not really applly here, so it seems

No problem can withstand the assault of sustained thinking.Voltaire

_Array2HTMLTable()_IEClassNameGetCollection()_IEquerySelectorAll()

Link to comment
Share on other sites

  • Solution

it do apply, only problem is (i think) that google refuse to take action.

if you dont finde beter solution this messy code can probably help you in same way

 

#include <IE.au3>
$winname = 'My Drive'
$buffer = _IEAttach($winname)
$colLinks = _IETagNameGetCollection($buffer, 'div')
For $oLink In $colLinks
If $oLink.className() = "goog-inline-block jfk-button jfk-button-primary goog-toolbar-item-new" Then
$x = _IEPropertyGet($oLink, 'screenx')
$y = _IEPropertyGet($oLink, 'screeny')
If $x > -1 And $y > -1 Then
$pos = ControlGetPos($winname, '', '[CLASS:Internet Explorer_Server; INSTANCE:1]')
$pos_win = WinGetPos($winname)
ControlClick($winname, '', '[CLASS:Internet Explorer_Server; INSTANCE:1]', 'left', 1, $x - ($pos_win[0] + $pos[0]), $y - ($pos_win[1] + $pos[1]))
Else
MsgBox(0,'Win need not to b minimized for this to work','')
EndIf
EndIf
Next
Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
Link to comment
Share on other sites

it do apply, only problem is (i think) that google refuse to take action.

if you dont finde beter solution this messy code can probably help you in same way

 

#include <IE.au3>
$winname = 'My Drive'
$buffer = _IEAttach($winname)
$colLinks = _IETagNameGetCollection($buffer, 'div')
For $oLink In $colLinks
If $oLink.className() = "goog-inline-block jfk-button jfk-button-primary goog-toolbar-item-new" Then
$x = _IEPropertyGet($oLink, 'screenx')
$y = _IEPropertyGet($oLink, 'screeny')
If $x > -1 And $y > -1 Then
$pos = ControlGetPos($winname, '', '[CLASS:Internet Explorer_Server; INSTANCE:1]')
$pos_win = WinGetPos($winname)
ControlClick($winname, '', '[CLASS:Internet Explorer_Server; INSTANCE:1]', 'left', 1, $x - ($pos_win[0] + $pos[0]), $y - ($pos_win[1] + $pos[1]))
Else
MsgBox(0,'Win need not to b minimized for this to work','')
EndIf
EndIf
Next

I love you. If I have see you in real life, I owe you a 6pack

Here is the revistion to make this work a bit faster without the loop, thanks so much!

_IELoadWait($googledoc)
_IENavigate($googledoc, "https://drive.google.com/")

$oLink = _IEGetObjByClass($googledoc, "goog-inline-block jfk-button jfk-button-primary goog-toolbar-item-new");main spreedsheet
$winname = _IEPropertyGet($googledoc, "title") &' - Windows Internet Explorer'
$x = _IEPropertyGet($oLink, 'screenx')
$y = _IEPropertyGet($oLink, 'screeny')
If $x > -1 And $y > -1 Then
    $pos = ControlGetPos($winname, '', '[CLASS:Internet Explorer_Server; INSTANCE:1]')
    $pos_win = WinGetPos($winname)
    ControlClick($winname, '', '[CLASS:Internet Explorer_Server; INSTANCE:1]', 'left', 1, $x - ($pos_win[0] + $pos[0]), $y - ($pos_win[1] + $pos[1]))
Else
    MsgBox(0, 'Error', 'window is minimized, or off screen')
EndIf


Func _IEGetObjByClass(ByRef $o_object, $s_Class, $i_index = 0)
    If Not IsObj($o_object) Then
        __IEErrorNotify("Error", "_IEGetObjByClass", "$_IEStatus_InvalidDataType")
        SetError($_IEStatus_InvalidDataType, 1)
        Return 0
    EndIf
    ;
    If Not __IEIsObjType($o_object, "browserdom") Then
        __IEErrorNotify("Error", "_IEGetObjByClass", "$_IEStatus_InvalidObjectType")
        SetError($_IEStatus_InvalidObjectType, 1)
        Return 0
    EndIf
    ;
    Local $i_found = 0
    ;
    $o_tags = _IETagNameAllGetCollection($o_object)
    For $o_tag In $o_tags
        If String($o_tag.className) = $s_Class Then
            If ($i_found = $i_index) Then
                SetError($_IEStatus_Success)
                Return $o_tag
            Else
                $i_found += 1
            EndIf
        EndIf
    Next
    ;
    __IEErrorNotify("Warning", "_IEGetObjByClass", "$_IEStatus_NoMatch", $s_Class)
    SetError($_IEStatus_NoMatch, 2)
    Return 0
EndFunc   ;==>_IEGetObjByClass

No problem can withstand the assault of sustained thinking.Voltaire

_Array2HTMLTable()_IEClassNameGetCollection()_IEquerySelectorAll()

Link to comment
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
 Share

×
×
  • Create New...