duzers Posted March 3, 2017 Posted March 3, 2017 Hello, site https://www.supermakler.pkobp.pl/plus/demo/ At the bottom of site there are some comboboxes and I can't select their values. Can somebody help me? Thx
Moderators JLogan3o13 Posted March 3, 2017 Moderators Posted March 3, 2017 @duzers welcome to the forum. The page does not load for me, but my first question would be, what have you tried on your own? Reading through the help file and the Wiki on the _IE* functions, or searching through the forum for the Chrome UDF should give you an idea of how to interact with web pages. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
duzers Posted March 3, 2017 Author Posted March 3, 2017 I can do many things with AutoIt but this problem is not solved by me in an elegant way. This is the reason why I'm here.
Danp2 Posted March 3, 2017 Posted March 3, 2017 These appear to be simulated combo boxes using an input field and an image. Latest Webdriver UDF Release Webdriver Wiki FAQs
duzers Posted March 3, 2017 Author Posted March 3, 2017 (edited) expandcollapse popup#include <IE.au3> #include <MsgBoxConstants.au3> Opt("WinTitleMatchMode", 2) $sUrl = "https://www.supermakler.pkobp.pl/plus/demo/main.html?id=FZ&fz=true&tytul=Nowe%20zlecenie" $iTryAttach = 1 $iVisible = 1 $iWait = 1 $iTakeFocus = 0 $oIE = _IECreate($sUrl, $iTryAttach, $iVisible, $iWait, $iTakeFocus) _idFields() Func _idFields() $num = 1 $colForms = _IEFormGetCollection($oIE) ; get all forms If @error Then Return SetError(1, @error, 0) For $oForm In $colForms ; loop over form collection ConsoleWrite("---- FORM " & $oForm.name & " --------------------" & @CRLF) $oFormElements = _IEFormElementGetCollection($oForm) ; get all elements if @error Then Return SetError(2, @error, 0) For $oFormElement In $oFormElements ; loop over element collection If StringInStr("input,textarea", $oFormElement.tagName) Then ; it is an input or textarea If StringInStr("button,reset,submit", $oFormElement.type) Then ContinueLoop;skip to next entry if type is button,hidden,reset,submit (file,password?) ConsoleWrite("> input." & $oFormElement.type & " " & $oFormElement.name & @CRLF) If $num == 1 Then _IEAction($oFormElement, "click") If $num == 3 Then _IEFormElementSetValue($oFormElement, "*", 1) If $num == 5 Then _IEFormElementSetValue($oFormElement, "ACLP", 1) ; set value of the field EndIf $num += 1 Next Next EndFunc ;==>_idFields Run twice. It is fill forms but after click "Wyslij" (eng. Submit) I get warning "Value in the box 'Walor' is required". Form doesn't see new value. Edited March 3, 2017 by duzers
Danp2 Posted March 3, 2017 Posted March 3, 2017 Not sure if this works (that's one strange site), but this is how I would write it -- #include <IE.au3> $sUrl = "https://www.supermakler.pkobp.pl/plus/demo/main.html?id=FZ&fz=true&tytul=Nowe%20zlecenie" $oIE = _IECreate($sUrl) Do Sleep(500) $oForm = _IEFormGetCollection($oIE, 0) Until @error = $_IESTATUS_Success _IEFormElementRadioSelect($oForm, 0, "gxt.RadioGroup.0", 1, 'byIndex') $oInput = _IEGetObjById($oIE, "x-auto-37-input") _IEFormElementSetValue($oInput, "*") $oInput = _IEGetObjById($oIE, "x-auto-40-input") _IEFormElementSetValue($oInput, "ACLP") _IEFormSubmit($oForm) Latest Webdriver UDF Release Webdriver Wiki FAQs
duzers Posted March 5, 2017 Author Posted March 5, 2017 No it is not working properly. I will try something like this: For $a In _IETagNameGetCollection($oIE, "a") If StringInStr(_IEPropertyGet($a, "innerText"), "Like") Then For $i = 1 To $repeat $a.fireEvent("onmousedown") $a.fireEvent("onmouseup") _IEAction($a, "click") _IELoadWait($oIE) Next EndIf Next
Danp2 Posted March 5, 2017 Posted March 5, 2017 2 hours ago, duzers said: No it is not working properly. Please be more specific. Did any of the input fields get updated? Etc. Latest Webdriver UDF Release Webdriver Wiki FAQs
Subz Posted March 5, 2017 Posted March 5, 2017 The problem filling in the fields is that it doesn't trigger the required action you can try: #include <IE.au3> $sUrl = "https://www.supermakler.pkobp.pl/plus/demo/main.html?id=FZ&fz=true&tytul=Nowe%20zlecenie" $oIE = _IECreate($sUrl, 1) _IELoadWait($oIE) $oNowe_zlecenie = _IEGetObjById($oIE, "x-auto-31") $oNowe_zlecenie.Click $oNowe_zlecenie = _IEGetObjById($oIE, "x-auto-37-input") $oNowe_zlecenie.NextSibling.Click() $oNowe_zlecenie.Value = "P" $oNowe_zlecenie.NextSibling.Click() $oNowe_zlecenie = _IEGetObjById ($oIE, "x-auto-40-input") $oNowe_zlecenie.NextSibling.Click() $oNowe_zlecenie.Value = "ACLP" $oNowe_zlecenie.NextSibling.Click() $oNowe_zlecenie = _IEGetObjById ($oIE, "x-auto-51-input") $oNowe_zlecenie.Click() Or for the main page use: #include <IE.au3> $sUrl = "https://www.supermakler.pkobp.pl/plus/demo/" $oIE = _IECreate($sUrl, 1) _IELoadWait($oIE) $oNowe_zlecenie = _IEGetObjById($oIE, "x-auto-264") $oNowe_zlecenie.Click $oNowe_zlecenie = _IEGetObjById($oIE, "x-auto-270-input") $oNowe_zlecenie.NextSibling.Click() $oNowe_zlecenie.Value = "P" $oNowe_zlecenie.NextSibling.Click() $oNowe_zlecenie = _IEGetObjById ($oIE, "x-auto-273-input") $oNowe_zlecenie.NextSibling.Click() $oNowe_zlecenie.Value = "ACLP" $oNowe_zlecenie.NextSibling.Click() $oNowe_zlecenie = _IEGetObjById ($oIE, "x-auto-284-input") $oNowe_zlecenie.Click() duzers 1
duzers Posted March 5, 2017 Author Posted March 5, 2017 Thank You! I didn't know that there is a function like ".NextSibling.Click()".
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now