Jump to content
Sign in to follow this  
uncommon

IE click google div (button)

Recommended Posts

uncommon

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()

Share this post


Link to post
Share on other sites
jdelaney

where is $create defined

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

Edited by jdelaney

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites
uncommon

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()

Share this post


Link to post
Share on other sites
uncommon

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()

Share this post


Link to post
Share on other sites
bogQ

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.

 

Share this post


Link to post
Share on other sites
uncommon

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()

Share this post


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
Sign in to follow this  

  • Similar Content

    • Seminko
      By Seminko
      Wrote a script that grabs all of the IP addresses from Netflix's IP log, checks the IPs and returns suspicious activity.
      Everything works as it should but only when _IECreate is set to visible. When visible is set to false, it fails to login for some reason.
      Any ideas what might cause it and/or how to circumvent that?
    • nooneclose
      By nooneclose
      I need to send a string of text to this popup and click on the ok button to save it.
      Here is the code I have so far:
      ;Start IE Sleep(7000) $oIE = _IECreate("http://www.google.com") Sleep(500) _IELoadWait($oIE) $hIE = _IEPropertyGet($oIE, "hwnd") ; Get Handle of the IE window Sleep(500) WinSetState($hIE, "", @SW_MAXIMIZE) ;Wait for a browser page load to complete Sleep(3000) _IENavigate($oIE, "https://properURL.com") Sleep(8000) _IELoadWait($oIE) ;Attach to a browser control embedded in another window $oIE = _IEAttach("https://"properURL.com", url") ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $oIE = ' & $oIE & @CRLF & '>Error code: ' & @error & ' Extended code: 0x' & Hex(@extended) & @CRLF) ;### Debug Console Sleep(2000) ;Get the title of the webpage ;Local $wTitle = _IEPropertyGet($oIE, "title") ;MsgBox($MB_SYSTEMMODAL, "Webpage title:", $wTitle) ;Clicks the new button Sleep(3000) _IEAction($nWorkOrderB, "focus") _IEAction($nWorkOrderB, "click") Sleep(5000) ;Store the Element names where the important data will be sent ;Store the long description button Local $wLongDButton = _IEGetObjById($oIE, "m65d795a4-img") ;Store the long Description field id Local $wComments = _IEGetObjById($oIE, "ma6499a9c-rte_iframe") ;Store the ok button id that is in the long description Local $wCommOk = _IEGetObjById($oIE, "m74031266-pb") ;******************************************************************************* ; Send the stored data to the proper field ;******************************************************************************* ;Click the long description button Sleep(300) _IEAction($wLongDButton, "focus") _IEAction($wLongDButton, "click") Sleep(300) ;Sends the Comments Sleep(500) _IEAction($wComments, "focus") _IEAction($wComments, "click") Sleep(500) _IEFormElementSetValue($wComments, "hello darkness my old friend") ;Click the ok button Sleep(500) _IEAction($wCommOk, "focus") _IEAction($wCommOk, "click") Sleep(500)  
      Here is the popup:

    • hemichallenger
      By hemichallenger
      Hello,
      If anyone can help, it would be greatly appreciated. The code is just an example and similar to the issue with an internal webpage. I'm trying to autofill than click the submit button. I get the same error running the script.
      _IEFormElementSetValue, $_IESTATUS_InvalidObjectType
      IEGetObjById, $_IESTATUS_NoMatch
      Is it possible to edit the <textarea></textarea>  field with AutoIt?  If anyone could assist me on how. Than I could have a better understanding and chance in figuring it out on my main script. Thank you
      #include <IE.au3> Local $oIE1 = _IECreate ("https://www.w3schools.com/tags/tryit.asp?filename=tryhtml_textarea") _IELoadWait($oIE1) local $oFormCollection = _IEFormGetCollection($oIE1,0) local $oid = _IEGetObjByid($oFormCollection, "iframeResult") _IEFormElementSetValue($oid, "test") sleep (2000) Local $oIE2 = _IECreate ("https://www.w3schools.com/html/tryit.asp?filename=tryhtml_scripts_intro") _IELoadWait($oIE2) $oForm2 = _IEFormGetCollection($oIE2,0) $oClickMe = _IEGetObjById($oForm2, "demo") _IEAction($oClickMe, "focus") _IEAction($oClickMe, "click")
    • nooneclose
      By nooneclose
      Hello again, I am in phase two of my help bot. I cannot figure out how to properly code Autoit to click on a webpage button using the I.E UDF. I want to click on the button that I have attached as an image. This button does not have a name but it has an ID. Here is the HTML code for this button that I found using chromes developer inspector.
      HTML Code: 
      <img role="button" tabindex="-1" id="toolactions_INSERT-tbb_image" src="nav_icon_insertkey.gif" alt="New Work Order CTRL+ALT+I" draggable="false"> Here is the code that I have so far:
      ;******************************************************************************* ; Opens IE and fill out a New Workorder ;******************************************************************************* ; Start IE at the ** Tracking Application in ****** $oIE = _IECreate("https:I_am_Bound_by_my_company_to_not_reveal_this_webpage") ; Wait for a browser page load to complete _IELoadWait($oIE) Sleep(6000) ; Store the field names where the important data will be sent Local $nWorkOrderB = _IEGetObjById($oIE, "toolactions_INSERT-tbb_image") _IEAction($nWorkOrderB, "click")  I want my program to click on the button that looks like a piece of paper with a blue # 
      (For those wondering, I am allowed to send images just not the URL.) 
      As always any help would be appreciated. 

×