Reyzor Posted July 24, 2018 Posted July 24, 2018 Hello! Im trying to do a script, where he open the website IE, use my username, password and select an option. but i can understand how select the option and click on button. Can someone help plz? i do this: #NoTrayIcon #include <IE.au3> Local $oIE =_IECreate("www.segurnet.pt") _IELoadWait($oIE) $Name = _IEGetObjByName($oIE, "username") $Password = _IEGetObjByName($oIE, "j_password") _IEPropertySet ($Name, 'innerText', 'test') _IEPropertySet ($Password, 'innerText', 'test12345') ; need select the option ;need click button to login. While 1 Sleep(10000) _IEAction($oIE, 'refresh') WEnd
FrancescoDiMuro Posted July 25, 2018 Posted July 25, 2018 Hi @Reyzor What about this? expandcollapse popup#include <IE.au3> Global $strURL = "https://www.segurnet.pt/", _ $objIE, _ $objUsername, _ $objPassword, _ $objComboBox, _ $objButton $objIE = _IECreate($strURL, 0, 1) If @error Then ConsoleWrite("Errore while creating the IE object. Error: " & @error & @CRLF) Else $objUsername = _IEGetObjById($objIE, "username") If @error Then ConsoleWrite("Error while obtaining the Username object field. Error: " & @error & @CRLF) Else _IEDocInsertText($objUsername, "Username") If @error Then ConsoleWrite("Error while typing the Username. Error: " & @error & @CRLF) Else $objPassword = _IEGetObjById($objIE, "j_password") If @error Then ConsoleWrite("Error while obtaining the Password object field. Error: " & @error & @CRLF) Else _IEDocInsertText($objPassword, "Password") If @error Then ConsoleWrite("Error while typing the Password. Error: " & @error & @CRLF) Else $objComboBox = _IEGetObjById($objIE, "company") If @error Then ConsoleWrite("Error while obtaining the Company object ComboBox. Error: " & @error & @CRLF) Else ; This allows you to select an option from a Select element, thanks to the text of an option of the Select element _IEFormElementOptionSelect($objComboBox, "Victoria Seguros", 1, "byText") If @error Then ConsoleWrite("Error: " & @error & @CRLF) Else $objButton = _IEGetObjById($objIE, "signin") If @error Then ConsoleWrite("Error while obtaining the Button object. Error: " & @error & @CRLF) Else ; Do stuffs... ; _IEQuit($objIE) EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf Using _IEFormElementOptionSelect() function, you can select and option from you Select element, even if it is not in a Form Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette
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