Jump to content

Recommended Posts

Hey there! :)

I am having a problem with clicking a button in IE. As you can see in the code, there would be a class name to click it, but since this button exists several times with exactly the same code, I can only use the "Noch nicht veröffentlicht" to separate it from the others. But this part is just pure text without any classification. 

"<div class="checkmark" data-v-1e5b1f70=""><svg xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 16 16" data-v-1e5b1f70=""><circle cx="8" cy="8" r="8" data-v-1e5b1f70="" /></svg></div>Noch nicht veröffentlicht"

I was trying to click it with:

#include <IE.au3>
   local $oNNVs = _IEFormGetCollection($oIE2)
   For $oNNV in $oNNVs
       If String($oNNV.innertext) = "Noch nicht veröffentlicht" Then
           _IEAction($oNNV, "click")
       EndIf
    Next

and:

$inputs = $oIE2.document.getElementsByTagName("div")
For $input In $inputs
    If $input.innertext == "Noch nicht veröffentlicht" then
        $input.click()
    EndIf
Next

But nothing seems to work. Thanks for the help!

Share this post


Link to post
Share on other sites

Try something like:
nb: Untested

#include <IE.au3>

Global $oIE = _IECreate("url")
If IsObj($oIE) Then
    $oDivs = _IETagNameGetCollection($oIE, "div")
    If IsObj($oDivs) Then
        For $oDiv In $oDivs
            If IsObj($oDiv) Then
                If $oDiv.className = "checkmark" And $oDiv.innerText = "Noch nicht veröffentlicht" Then
                    _IEAction($oDiv, "click")
                EndIf
            EndIf
        Next
    EndIf
EndIf

 

Share this post


Link to post
Share on other sites

@_leo_

Difficult to try without accessing the website, so we can only guess.

Are you sure that the text does not contain any space or any other character that could make the If statement false in both cases? :)


Click here to see my signature:

Spoiler

Thoughts:

  • I will always thank you for the time you spent for me.
    I'm here to ask, and from your response, I'd like to learn.
    By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/

ALWAYS GOOD TO READ:

 

Share this post


Link to post
Share on other sites
47 minutes ago, Subz said:

Try something like:
nb: Untested

#include <IE.au3>

Global $oIE = _IECreate("url")
If IsObj($oIE) Then
    $oDivs = _IETagNameGetCollection($oIE, "div")
    If IsObj($oDivs) Then
        For $oDiv In $oDivs
            If IsObj($oDiv) Then
                If $oDiv.className = "checkmark" And $oDiv.innerText = "Noch nicht veröffentlicht" Then
                    _IEAction($oDiv, "click")
                EndIf
            EndIf
        Next
    EndIf
EndIf

 

Thank you! Unfortunatly it does not peform a click, although I don't get an error. I think the problem is within the following part:

$oDiv.innerText = "Noch nicht veröffentlicht"

If I delete this part, it makes a click. But on the wrong/last object and obviously not on the "Noch nicht veröffentlicht" one. Maybe because "Noch nicht veröffentlicht" is written on a separate line in the DOM?

Share this post


Link to post
Share on other sites

Try changing the line to:

If $oDiv.className = "checkmark" And StringStripWS($oDiv.innerText, 7) = "Noch nicht veröffentlicht" Then

Also use ConsoleWrite to show the text for example:
nb: This will show any white space between the "XXXX"

ConsoleWrite("XXXX" & $oDiv.innerText & "XXXX" & @CRLF)

 

Share this post


Link to post
Share on other sites
2 hours ago, Subz said:

Try changing the line to:

If $oDiv.className = "checkmark" And StringStripWS($oDiv.innerText, 7) = "Noch nicht veröffentlicht" Then

Also use ConsoleWrite to show the text for example:
nb: This will show any white space between the "XXXX"

ConsoleWrite("XXXX" & $oDiv.innerText & "XXXX" & @CRLF)

 

Thanks for the suggestion, but it still did not do a click.

What should I expect from the ConsoleWrite? I got a loooooot of text written to the console.

$oDivs = _IETagNameGetCollection($oIE2, "div")
    If IsObj($oDivs) Then
        For $oDiv In $oDivs
            If IsObj($oDiv) Then
                If $oDiv.className = "checkmark" And StringStripWS($oDiv.innerText, 7) = "Noch nicht veröffentlicht" Then
                    _IEAction($oDiv, "click")
                 EndIf
               ConsoleWrite("XXXX" & $oDiv.innerText & "XXXX" & @CRLF)
            EndIf
        Next
    EndIf

At the moment it is looking like this. I am scared that I'll have to use a regular mouseclick. Save me!😃

Share this post


Link to post
Share on other sites
1 hour ago, Nine said:

I think the problem is that the innertext is OUTSIDE the "checkmark".  The classname should be "item".  Modify it accordingly and add an ExitLoop after the click...

Yeeeaahhh! That did it!! Thank you so much:thumbsup:

Share this post


Link to post
Share on other sites

@_Leo_  Sorry didn't see that the checkmark div was closed, I need to update my glasses :blink:.  Just for future reference try posting the parent tags along with the item you're trying to manipulate, as it will help us to replicate the code, to help with the solution.

Share this post


Link to post
Share on other sites
On 7/20/2019 at 2:52 PM, Danp2 said:

Suggest that you post a larger segment of HTML or the URL, if possible.

Hey @Danp2

I figured out, that the website I am trying to automate is no longer working with IE. So I decided to rewriete my script to Webdriver UDF for Google Chrome. And since you seem like the "pro" with the wedriver, I'd love to ask for you help. ☺️

My new code is:

#include "wd_core.au3"
    #include "wd_helper.au3"
    
    Global $sSession, $sSession2
    Global $sDesiredCapabilities
    
     SetupChrome()
   _WD_Startup()
   
    $sSession = _WD_CreateSession($sDesiredCapabilities)
   _WD_Navigate($sSession, "url") 
   
   _WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, "//*[text()='Noch nicht veröffentlicht']") ;Noch Nicht Veröffnetlicht
   $oNNV = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//*[(text(),'Noch nicht veröffentlicht')]")
   _WD_ElementAction($sSession, $oNNV, 'click')
   
   ;more code....

 

 Is it possible to click the element with the Webdriver? I am getting the following result: 

I thought the issue could be with the "ö", but it didnt work when I deleted "veröffentlicht".. Please let me know if you have any suggestions.

 

Quote

__WD_Post: URL=HTTP://127.0.0.1:9515/session/749bb00d8d317df99583768cc1b53d83/element; $sData={"using":"xpath","value":"//*[text()='Noch nicht veröffentlicht']"}
__WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"b5a42b27-819c-4b64-b917-795802d8c799"}}
_WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"b5a42b27-819c-4b64-b917-795802d8c799"}}
_WD_WaitElement ==> Success
__WD_Post: URL=HTTP://127.0.0.1:9515/session/749bb00d8d317df99583768cc1b53d83/element; $sData={"using":"xpath","value":"//*[(text(),'Noch nicht veröffentlicht')]"}
__WD_Post: StatusCode=400; ResponseText={"value":{"error":"invalid selector","message":"invalid selector: Unable to locate an element with the xpath expression //*[(text(),'Noch nicht veröffentlicht')] because of the following error:\nSyntaxError: Failed to execute 'evaluate' on 'Document': The string '//*[(text(),'Noch nicht veröffentlicht')]' is not a valid XPath expression.\n  (Session info: chrome=75.0.3770.142)","stacktrace":"Backtrace:\n\tOrdinal0 [0x01321B43+1448771]\n\tOrdinal0 [0x012A5A31+940593]\n\tOrdinal0 [0x01232293+467603]\n\tOrdinal0 [0x01233E03+474627]\n\tOrdinal0 [0x01233CF2+474354]\n\tOrdinal0 [0x011D624B+90699]\n\tOrdinal0 [0x011EF520+193824]\n\tOrdinal0 [0x011E7180+160128]\n\tOrdinal0 [0x011EE36B+189291]\n\tOrdinal0 [0x011E6FEB+159723]\n\tOrdinal0 [0x011D09F6+68086]\n\tOrdinal0 [0x011D1990+72080]\n\tOrdinal0 [0x011D1929+71977]\n\tGetHandleVerifier [0x01462E8C+1172172]\n\tGetHandleVerifier [0x013BFE55+504469]\n\tGetHandleVerifier [0x013BFBF0+503856]\n\tOrdinal0 [0x0132C9C8+1493448]\n\tGetHandleVerifier [0x013C062A+506474]\n\tOrdinal0 [0x012B7156+1012054]\n\tOrdinal0 [0x012B6FCF+1011663]\n\tOrdinal0 [0x012C135B+1053531]\n\tOrdinal0 [0x012C14C3+1053891]\n\tOrdinal0 [0x012C04F5+1049845]\n\tBaseThreadInitThunk [0x765D8494+36]\n\tRtlAreBitsSet [0x778C41C8+136]\n\tRtlAreBitsSet [0x778C4198+88]\n"}}
_WD_FindElement: {"value":{"error":"invalid selector","message":"invalid selector: Unable to locate an element with the xpath expression //*[(text(),'Noch nicht veröffentlicht')] because of the following error:\nSyntaxError: Failed to execute 'evaluate' on 'Document': The string '//*[(text(),'Noch nicht veröffentlicht')]' is not a valid XPath expression.\n  (Session info: chrome=75.0.3770.142)","stacktrace":"Backtrace:\n\tOrdinal0 [0x01321B43+1448771]\n\tOrdinal0 [0x012A5A31+940593]\n\tOrdinal0 [0x01232293+467603]\n\tOrdinal0 [0x01233E03+474627]\n\tOrdinal0 [0x01233CF2+474354]\n\tOrdinal0 [0x011D624B+90699]\n\tOrdinal0 [0x011EF520+193824]\n\tOrdinal0 [0x011E7180+160128]\n\tOrdinal0 [0x011EE36B+189291]\n\tOrdinal0 [0x011E6FEB+159723]\n\tOrdinal0 [0x011D09F6+68086]\n\tOrdinal0 [0x011D1990+72080]\n\tOrdinal0 [0x011D1929+71977]\n\tGetHandleVerifier [0x01462E8C+1172172]\n\tGetHandleVerifier [0x013BFE55+504469]\n\tGetHandleVerifier [0x013BFBF0+503856]\n\tOrdinal0 [0x0132C9C8+1493448]\n\tGetHandleVerifier [0x013C062A+506474]\n\tOrdinal0 [0x012B7156+1012054]\n\tOrdinal0 [0x012B6FCF+1011663]\n\tOrdinal0 [0x012C135B+1053531]\n\tOrdinal0 [0x012C14C3+1053891]\n\tOrdinal0 [0x012C04F5+1049845]\n\tBaseThreadInitThunk [0x765D8494+36]\n\tRtlAreBitsSet [0x778C41C8+136]\n\tRtlAreBitsSet [0x778C4198+88]\n"}}
_WD_FindElement ==> Webdriver Exception: HTTP status = 400
__WD_Post: URL=HTTP://127.0.0.1:9515/session/749bb00d8d317df99583768cc1b53d83/element//click; $sData={"id":""}
__WD_Post: StatusCode=404; ResponseText={"value":{"error":"no such element","message":"no such element: Element_id length is invalid\n  (Session info: chrome=75.0.3770.142)","stacktrace":"Backtrace:\n\tOrdinal0 [0x01321B43+1448771]\n\tOrdinal0 [0x012A5A31+940593]\n\tOrdinal0 [0x01232293+467603]\n\tOrdinal0 [0x011D5DA0+89504]\n\tOrdinal0 [0x011D7056+94294]\n\tOrdinal0 [0x011D2602+75266]\n\tOrdinal0 [0x011E714D+160077]\n\tOrdinal0 [0x011D23C6+74694]\n\tOrdinal0 [0x011E7361+160609]\n\tOrdinal0 [0x011EE36B+189291]\n\tOrdinal0 [0x011E6FEB+159723]\n\tOrdinal0 [0x011D09F6+68086]\n\tOrdinal0 [0x011D1990+72080]\n\tOrdinal0 [0x011D1929+71977]\n\tGetHandleVerifier [0x01462E8C+1172172]\n\tGetHandleVerifier [0x013BFE55+504469]\n\tGetHandleVerifier [0x013BFBF0+503856]\n\tOrdinal0 [0x0132C9C8+1493448]\n\tGetHandleVerifier [0x013C062A+506474]\n\tOrdinal0 [0x012B7156+1012054]\n\tOrdinal0 [0x012B6FCF+1011663]\n\tOrdinal0 [0x012C135B+1053531]\n\tOrdinal0 [0x012C14C3+1053891]\n\tOrdinal0 [0x012C04F5+1049845]\n\tBaseThreadInitThunk [0x765D8494+36]\n\tRtlAreBitsSet [0x778C41C8+136]\n\tRtlAreBitsSet [0x778C4198+88]\n"}}
_WD_ElementAction: {"value":{"error":"no such element","message":"no such element: Element_id length is invalid\n  (Ses...
_WD_ElementAction ==> Webdriver Exception: {"value":{"error":"no such element","message":"no such element: Element_id length is invalid\n  (Session info: chrome=75.0.3770.142)","stacktrace":"Backtrace:\n\tOrdinal0 [0x01321B43+1448771]\n\tOrdinal0 [0x012A5A31+940593]\n

 

Share this post


Link to post
Share on other sites

$oNNV = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//*[(text(),'Noch nicht veröffentlicht')]")

 the comma in text(),'Noch' is the problem , use ' = ' as u did in _WD_WaitElement

 

Share this post


Link to post
Share on other sites

Thanks you for taking time! I appreciate it. @Network_Guy @Danp2

I tried both of your suggestions, but I keep getting weird errors. Like this:

Quote

 ==> Error parsing function call.:
_WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, "//div[@class='item' and contains(text(), 'Noch nicht veröffentlicht')]"
_WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, ^ ERROR
>Exit code: 1    Time: 28.58

I dont know what is wrong with the ". I replaced it with single quotaition marks ', but then I got this error:

Quote

==> Unable to parse line.: 
_WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, '//div[@class='item' and contains(text(), 'Noch nicht veröffentlicht')]' 
_WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, '//div[@class='item' and contains(text(), 'Noch nicht ver^ ERROR
>Exit code: 1    Time: 0.3491

So I tried to remove the "veröffentlicht", and... tadaaaaaa... the next error.

Quote

 ==> Error parsing function call.:
_WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, '//div[@class='item' and contains(text(), 'Noch nicht')]'
_WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, '//div[@class='item' and contains(text(), 'Noch nicht^ ERROR

Thanks for helping!

Share this post


Link to post
Share on other sites

You clearly didn't read what he said:

5 hours ago, Network_Guy said:

$oNNV = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//*[(text(),'Noch nicht veröffentlicht')]")

 the comma in text(),'Noch' is the problem , use ' = ' as u did in _WD_WaitElement

 

You kept the comma in your script.

Change it to:

$oNNV = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//*[(text()='Noch nicht veröffentlicht')]")

 

Share this post


Link to post
Share on other sites
Posted (edited)

Thanks! @Davidowicza Ohh.. That's embarrassing😄

Unfortunatly I am getting the same error after changing:

Quote

_WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, "//div[@class='item' and contains(text()='Noch nicht veröffentlicht')]"
_WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, ^ ERROR

so i guess there is still something invalid..

and with the following I am getting this: "//*[(text()='?Noch nicht veröffentlic?ht')]" even though there are no question marks in my code. so strange..

_WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, "//*[(text()='Noch nicht veröffentlicht')]") ;Noch Nicht Veröffnetlicht
   $oNNV = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//*[(text()='Noch nicht veröffentlicht')]")
   _WD_ElementAction($sSession, $oNNV, 'click')
Quote

__WD_Post: URL=HTTP://127.0.0.1:9515/session/ea5c17a97acf731ef72f9ba6bc9d49f4/element; $sData={"using":"xpath","value":"//*[(text()='?Noch nicht veröffentlic?ht')]"}
__WD_Post: StatusCode=404; ResponseText={"value":{"error":"no such element","message":"no such element: Unable to locate element: {\"method\":\"xpath\",\"selector\":\"//*[(text()='?Noch nicht veröffentlic?ht')]\"}\n  (Session info: chrome=75.0.3770.142)","stacktrace":"Backtrace:\n\tOrdinal0 [0x013A1B43+1448771]\n\tOrdinal0 [0x01325A31+940593]\n\tOrdinal0 [0x012B2293+467603]\n\tOrdinal0 [0x01256463+91235]\n\tOrdinal0 [0x0126F520+193824]\n\tOrdinal0 [0x01267180+160128]\n\tOrdinal0 [0x0126E36B+189291]\n\tOrdinal0 [0x01266FEB+159723]\n\tOrdinal0 [0x012509F6+68086]\n\tOrdinal0 [0x01251990+72080]\n\tOrdinal0 [0x01251929+71977]\n\tGetHandleVerifier [0x014E2E8C+1172172]\n\tGetHandleVerifier [0x0143FE55+504469]\n\tGetHandleVerifier [0x0143FBF0+503856]\n\tOrdinal0 [0x013AC9C8+1493448]\n\tGetHandleVerifier [0x0144062A+506474]\n\tOrdinal0 [0x01337156+1012054]\n\tOrdinal0 [0x01336FCF+1011663]\n\tOrdinal0 [0x0134135B+1053531]\n\tOrdinal0 [0x013414C3+1053891]\n\tOrdinal0 [0x013404F5+1049845]\n\tBaseThreadInitThunk [0x765D8494+36]\n\tRtlAreBitsSet [0x778C41C8+136]\n\tRtlAreBitsSet [0x778C4198+88]\n"}}
_WD_FindElement: {"value":{"error":"no such element","message":"no such element: Unable to locate element: {\"method\":\"xpath\",\"selector\":\"//*[(text()='?Noch nicht veröffentlic?ht')]\"}\n  (Session info: chrome=75.0.3770.142)","stacktrace":"Backtrace:\n\tOrdinal0 [0x013A1B43+1448771]\n\tOrdinal0 [0x01325A31+940593]\n\tOrdinal0 [0x012B2293+467603]\n\tOrdinal0 [0x01256463+91235]\n\tOrdinal0 [0x0126F520+193824]\n\tOrdinal0 [0x01267180+160128]\n\tOrdinal0 [0x0126E36B+189291]\n\tOrdinal0 [0x01266FEB+159723]\n\tOrdinal0 [0x012509F6+68086]\n\tOrdinal0 [0x01251990+72080]\n\tOrdinal0 [0x01251929+71977]\n\tGetHandleVerifier [0x014E2E8C+1172172]\n\tGetHandleVerifier [0x0143FE55+504469]\n\tGetHandleVerifier [0x0143FBF0+503856]\n\tOrdinal0 [0x013AC9C8+1493448]\n\tGetHandleVerifier [0x0144062A+506474]\n\tOrdinal0 [0x01337156+1012054]\n\tOrdinal0 [0x01336FCF+1011663]\n\tOrdinal0 [0x0134135B+1053531]\n\tOrdinal0 [0x013414C3+1053891]\n\tOrdinal0 [0x013404F5+1049845]\n\tBaseThreadInitThunk [0x765D8494+36]\n\tRtlAreBitsSet [0x778C41C8+136]\n\tRtlAreBitsSet [0x778C4198+88]\n"}}
_WD_FindElement ==> No match: HTTP status = 404

 

 

 

 

Edited by _leo_

Share this post


Link to post
Share on other sites

Thanks! I got the syntax error out of the way after rewriting 100 times, restarting autoit, and rebooting... 

Everything would work fine.. but I am getting a message that the element is not clickable. I figured out, that there is an other element with the same text name and the script tries to refer to the wrong one. 

Quote

"error":"element click intercepted","message":"element click intercepted: Element \u003Cspan data-v-7abc0274=\"\" class=\"text-truncate\">...\u003C/span> is not clickable at point

 

So i guess I have to get the classname in there aswell, to identify it completly (with the suggestion from @Danp2.) Therefore my code looks like this. And somehow the previous error is gone, but a new Syntax error has occured.

_WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, "//div[@class='item' and contains(text()='Noch nicht veröffentlicht')]")
    $NNV = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//div[@class='item' and contains(text()='Noch nicht veröffentlicht')]")
    _WD_ElementAction($sSession, $NNV, 'click')
Quote

_WD_FindElement: {"value":{"error":"invalid selector","message":"invalid selector: Unable to locate an element with the xpath expression //div[@class='item' and contains(text()='Noch nicht veröffentlicht')] because of the following error:\nSyntaxError: Failed to execute 'evaluate' on 'Document': The string '//div[@class='item' and contains(text()='Noch nicht veröffentlicht')]' is not a valid XPath expression.\n  (Session info: chrome=75.0.3770.142)","stacktrace":"Backtrace:\n\tOrdinal0 

I read this line a million times. I dont see a syntax mistake... Please someone buy me new eyes🧐

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

  • Similar Content

    • By nacerbaaziz
      good morning all.
      first lit me give you all a thinks to your help
      you're help me allot thank you all.
      sirs today i've a new problem
      it's not a problem but thing i want to add it to blind accessability.
      the ListBox can send a notification when the user send a double click on it items
      but as we know that the blind users can't use the mouse for that they use the keybord to navigate.
      as we know that the enter replace the double click on the keybord
      for that i need when the user send a inter above any listBox item the list send a double click notification.
      i know some of you tell me that i can use the  GUISetAccelerators function
      but the enter has a other tasks such as leav a blanc line on edits and activate the defaultButton and other tasks.
      that what i need and i hope that you can help me
      this is a simple example.
      #include <GUIConstantsEx.au3> #include <StructureConstants.au3> #include <MsgBoxConstants.au3> #include <WindowsConstants.au3> #include <ListBoxConstants.au3> Example() Func Example() Local $sMESSAGE = "The following buttons have been clicked" GUICreate("My GUI list") ; will create a dialog box that when displayed is centered Local $idButton_Add = GUICtrlCreateButton("Add", 64, 32, 75, 25) Local $idButton_Clear = GUICtrlCreateButton("Clear", 64, 72, 75, 25) global $idMylist = GUICtrlCreateList("buttons that have been clicked", 176, 32, 121, 97) GUICtrlSetLimit(-1, 200) ; to limit horizontal scrolling GUICtrlSetData(-1, $sMESSAGE) global $DummyList = GUICtrlCreateDummy() GUICtrlSendToDummy($DummyList, 1) Local $idButton_Close = GUICtrlCreateButton("my closing button", 64, 160, 175, 25) GUIRegisterMsg($WM_command, "WM_command") GUISetState(@SW_SHOW) ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $idButton_Add GUICtrlSetData($idMylist, "You clicked button No1|") Case $idButton_Clear GUICtrlSetData($idMylist, "") Case $idButton_Close MsgBox($MB_SYSTEMMODAL, "", "the closing button has been clicked", 2) Exit case $DummyList $g_iTemp = GUICtrlRead($DummyList) if $g_iTemp = $LBN_DBLCLK then ;$LBN_DBLCLK then msgBox(64, "", "") endIf GUICtrlSendToDummy($DummyList, 0) EndSwitch WEnd EndFunc ;==>Example Func WM_command($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg Local $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = $lParam $iCode = BitShift($wParam, 16) ; Hi Word Switch $hWndFrom Case GUICtrlGetHandle($idMylist) Switch $iCode Case $LBN_SELCHANGE, $LBN_DBLCLK, $LBN_SELCANCEL, $LBN_SETFOCUS GUICtrlSendToDummy($DummyList, $iCode) case else ;GUICtrlSendToDummy($DummyTreeview, 1) EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc  
    • By yffulf
      Is there probably a way to click ie popup button and hide or invisible popup button in the same time?
      I try to use WinSetState @SW_hide ,
      the result is ie crashing or no response because button hide and the next click command won't work...
      $oForm=_IEFormGetObjByName($oIE,"form1") $obutton=_IEFormElementGetObjByName($oForm,"btn_OK") $hWnd = _IEPropertyGet($oIE, "hwnd") _IEAction($obutton,"focus") ControlSend($hWnd, "", "[CLASS:Internet Explorer_Server; INSTANCE:1]", "{Enter}") WinWait("", "確定存檔嗎?") WinSetState("","確定存檔嗎?",@SW_Hide) ControlClick("", "確定存檔嗎?", "[CLASS:Button; TEXT:確定; Instance:1;]")  
    • By TXTechie
      Hello Everyone,
      I'm looking for a way to use an already open Internet Explorer (IE) window (if one is up and running) and then navigate to a new URL in a new IE tab.
      I thought that _IECreate would easily meet my needs. However, when I use the following script:
      #include <IE.au3> Local $oIE = _IECreate("https://" & $Server & ":8444/", 1, 1, 0, 1) ...with one or more open IE windows, it still opens yet a new IE window.
      Are there any other ideas for how to reliably use an already open IE windows and then how to open a new tab in IE to navigate to a new URL?
      Regards,
      TX Techie
    • By WoodGrain
      Hi All,
      I've tried to create a script to browse to a web page in IE, but it only works for some sites, I've tried to simplify the script as much as possible, hoping you can point me in the right direction - thanks.
      This one going to Google does work:
      #include <IE.au3> $oIE = _IECreate("https://www.google.com.au/", 0, 1, 1) _IELoadWait($oIE) _IEQuit($oIE) But this one going to OneDrive opens the IE page, but fails immediately returning the errors, and the IE window is not closed:
      --> IE.au3 T3.0-2 Error from function _IELoadWait, $_IESTATUS_ClientDisconnected (-2147023174, Browser has been deleted prior to operation.)
      --> IE.au3 T3.0-2 Error from function _IELoadWait, $_IESTATUS_InvalidObjectType ()
      --> IE.au3 T3.0-2 Error from function _IEQuit, $_IESTATUS_InvalidObjectType
      #include <IE.au3> $oIE = _IECreate("https://abccorp-my.sharepoint.com/", 0, 1, 1) _IELoadWait($oIE) _IEQuit($oIE) Even if I put a sleep timer in for 10 seconds after the _IECreate it still doesn't work
      Thanks all!
    • By Dent
      https://rmplusportal.rightmove.co.uk/
      On that page is a login form requiring username, password and then the clicking of the button (or pressing enter but I'm not a fan of using Send)
      Here's the section of code from the page that specifically deals with the form...
      <form> <div class="error-message-login" data-test="error-message"></div> <label> <span>User email</span> <div class="ui input"> <input id="email" type="text" placeholder="Your email"> </div> </label> <label> <span>Password</span> <div class="ui input"> <input id="password" type="password" placeholder="Password"> </div> </label> <button class="ui primary button" role="button" data-test="login">Login</button> <p> <a class="forgot-your-password" href="https://www.rightmove.co.uk/forgottenPasswordForm.html">Forgot your password?</a> </p> </form> Specifically the <button class...></button> is causing me problems as I can't find a way to click it. The 'User email' and 'Password' objects have an 'id' so I can reference these in the AutoIT code and interact with them and the button also previously had the id of 'login' but I guess in a change to this page that was altered.
      Oddly, if I get the code to show the instance of IE that is created and manually click Login or press Enter the page gives me an error saying 'Please enter your email address' even though it is there. I have to manually go into each field and make a change i.e. adding a character to the end of each field then deleting it before it will let me in by either clicking Login or pressing enter. So maybe there's so code elsewhere on the page that knows the fields haven't been physically typed in?
      Any help on this would be much appreciated.
×
×
  • Create New...