2 posts in this topic
I have a very complex IE page with lots of Java and Iframes. I need to be able to look for a change in one <input> field. So what i have done is to identify the field and hook an event listener with ObjEvent($title, "_Evt_") and then i use :
Func _Evt_OnChange() Local $o_object = @COM_EventObj ConsoleWrite( "Change" & $o_object.value &@CRLF) _FileWriteLine($MainLog, "Change:" & _NOW()) TitleCheck($o_object.value) EndFunc Which work fine user doesn't interact with some of the other buttons or radios on the page. As soon as the user does some interaction or refreshes the page or navigates - the event listener is 'deleted' somehow and no longer works. Any idea how to counteract that? The easiest this is to detect if there is ANY change on the page - then i can identify the INPUT and check for its value. Any idea how to do that ?
[SOLVED] Possibly used before declaration error in IE.au3
So I have a script that interacts with IE but for some reason I can't identify I'm getting the 'possibly used before declaration' error even though I've declared and used those variables.
Local $oPlayer1FSPC = _IEGetObjByName($oIE, "fs") $oPlayer1FSPC.Value = $sFirstServePc1 Local $oPlayer2FSPC = _IEGetObjByName($oIE, "ofs") $oPlayer2FSPC.Value = $sFirstServePc2 Local $oPlayer1FSWPC = _IEGetObjByName($oIE, "fsw") $oPlayer1FSWPC.Value = $sFirstServeWonPc1 Local $oPlayer2FSWPC = _IEGetObjByName($oIE, "ofsw") $oPlayer2FSWPC.Value = $sFirstServeWonPc2 Local $oPlayer1SSWPC = _IEGetObjByName($oIE, "ssw") $oPlayer1SSWPC.Value = $sSecondServeWonPc1 Local $oPlayer2SSWPC = _IEGetObjByName($oIE, "ossw") $oPlayer2SSWPC.Value = $sSecondServeWonPc2 Local $oPlayer1BPS = _IEGetObjByName($oIE, "kps") $oPlayer1BPS.Value = $sBPSavePc1 Local $oPlayer2BPS = _IEGetObjByName($oIE, "kpb") $oPlayer2BPS.Value = $sBPSavePc2 The $s variables have had strings assigned earlier in the script and I've tested that with ConsoleWrite
How to click THIS Login button
At this site http://tennisinsight.com/ there is a Login button at the top, how do I click this? I can set the fields for username and password but everything I've tried to click Login does not work.
I don't really want to have to do a pixelsearch and move the mouse to click the button.
Can't read style element
I'm trying to create an autoPop tool for AliExpress. When I get to their address page, there are a number of input fields. There are also two drop downs. One is for the country and, depending on what you select, the other dropdown appears with city names or, a standard input box is visible to add a city (See the images). So if I select "United States" the other dropdown is visible with all the states. If I select "France", the input box is visible to enter a French city. Seems cool enough but I'm really struggling trying to get this to work.
This is my test code to work all this out:
#include <MsgBoxConstants.au3> #include <IE.au3> Local $StartPos Local $oIE = _IECreate("https://shoppingcart.aliexpress.com/order/confirm_order.htm?objectId=1792065272&from=aliexpress&countryCode=US&shippingCompany=EMS&provinceCode=&cityCode=&promiseId=&itemCondition=&=556&aeOrderFrom=main_detail&skuAttr=&quantity=1") If @error Then Exit MsgBox(16, "openURL Error", @CRLF & "@error = " & @error & ", @extended = " & @extended) ;If $bVerbose == true Then MsgBox(0, "openURL", "IECreate Object Created") ;Get the Collections $oInputs = _IETagNameGetCollection($oIE, "input"); Input Fields $oSelects = _IETagNameGetCollection($oIE, "select"); Select Fields ;Loop through the Selects For $oSelect In $oSelects If $oSelect.name = "country" Then _IEFormElementOptionSelect($oSelect, "France", 1, "byText",1) Next ;Loop through the inputs For $oInput In $oInputs If $oInput.name = "email" Then $oInput.Value = "email@example.com" If $oInput.name = "contactPerson" Then $oInput.Value = "My Full Name" If $oInput.name = "address" Then $oInput.Value = "123 Anystreet" If $oInput.name = "address2" Then $oInput.Value = "NA" If $oInput.name = "province" Then MsgBox(0, "","$oInput.name = " & $oInput.name &@CRLF &"$oInput.style = " & $oInput.style &@CRLF &"$oInput.type = " & $oInput.type&@CRLF &"$oInput.maxLength = " & $oInput.maxlength) $oInput.Value = "FrenchyLand" EndIf If $oInput.name = "city" Then $oInput.Value = "AnyTown" If $oInput.name = "zip" Then $oInput.Value = "12345" If $oInput.name = "mobileNo" Then $oInput.Value = "1-415-555-1212" Next So I open the page on AliExpress and get an "input" collection and a "select" Collection
I first loop through the Selects until I find "country" and then select "France"
I then loop through all the inputs and put the information in the correct inputs.
When the country is one that AliExpress knows the states or provinces for, they swap Styles between the input box and the dropdown to either "display: inline-block;" or "display: none;" which hides one, or the other (See the AliExpDOM Image).
Problem #1: When I use the "_IEFormElementOptionSelect($oSelect, "France", 1, "byText",1)" To make the dropdown selection, It selects it but does not invoke the widget to change the second dropdown to an input box.
Problem #2: I thought a possible solution would be to read the Style of the input box and based on the value, either place text in the input box or go to the dropdown and make a selection. I can't seem to read the Style attribute from the collection ie: $oInput.style returns nothing.
Any help here would be greatly appreciated. If I figure out a solution before and answer here, I will publish it here for anyone else who might be struggling with these kinds of things
Stucks after "File to upload" window
Greeting, so I've been trying to come up with solution, but no luck. Despite I tried to automate upload function, I released that it freezes after "Choose File to Upload" window appears..
#include <IE.au3> ;#include <_Dbug.au3> Global $oIE = _IECreate("http://tinypic.com/", 1) Global $upload2 = _IEGetObjById($oIE, "the_file") _IEAction($upload2, "click") ;Sleep(1000) $hWnd = WinGetHandle("Choose File to Upload") MsgBox(0, "", $hWnd) Have anybody faced this situation?
btw: srry for the advertise Besides it's no matter which site I'm trying to do this it's all the same.