HADE Posted March 1, 2019 Posted March 1, 2019 Hi I want to click on a button that does not have an ID or name, so I would like you to help me with thanks code: <button type="button" class="btn btn-success" data-toggle="modal" data-target="#sharesmodal"><i class="fa fa-forward"></i> Use</button>
Subz Posted March 1, 2019 Posted March 1, 2019 Maybe something like: Local $oButtons = _IETagNameAllGetCollection($oIE, "button") If IsObj($oButtons) Then For $oButton In $oButtons If $oButton.className = "btn btn-success" Then _IEAction($oButton, "click") ExitLoop EndIf Next EndIf HADE 1
HADE Posted March 1, 2019 Author Posted March 1, 2019 2 minutes ago, Subz said: Maybe something like: Local $oButtons = _IETagNameAllGetCollection($oIE, "button") If IsObj($oButtons) Then For $oButton In $oButtons If $oButton.className = "btn btn-success" Then _IEAction($oButton, "click") ExitLoop EndIf Next EndIf not working please help me #include <IE.au3> Local $oIE = _IECreate("https://viptools.es/") Local $oButtons = _IETagNameAllGetCollection($oIE, "button") If IsObj($oButtons) Then For $oButton In $oButtons If $oButton.className = "btn btn-success" Then _IEAction($oButton, "click") ExitLoop EndIf Next EndIf
Subz Posted March 1, 2019 Posted March 1, 2019 Try: #include <IE.au3> Local $oIE = _IECreate("https://viptools.es", 1) _IELoadWait($oIE) Local $oButtons = _IETagNameGetCollection($oIE, "button") If IsObj($oButtons) Then For $oButton In $oButtons If $oButton.getAttribute("data-target") = "#sharesmodal" Then _IEAction($oButton, "click") ExitLoop EndIf Next EndIf alienclone 1
HADE Posted March 1, 2019 Author Posted March 1, 2019 1 hour ago, Subz said: Try: #include <IE.au3> Local $oIE = _IECreate("https://viptools.es", 1) _IELoadWait($oIE) Local $oButtons = _IETagNameGetCollection($oIE, "button") If IsObj($oButtons) Then For $oButton In $oButtons If $oButton.getAttribute("data-target") = "#sharesmodal" Then _IEAction($oButton, "click") ExitLoop EndIf Next EndIf thanks you ♥ love
HADE Posted March 1, 2019 Author Posted March 1, 2019 1 hour ago, Subz said: Try: #include <IE.au3> Local $oIE = _IECreate("https://viptools.es", 1) _IELoadWait($oIE) Local $oButtons = _IETagNameGetCollection($oIE, "button") If IsObj($oButtons) Then For $oButton In $oButtons If $oButton.getAttribute("data-target") = "#sharesmodal" Then _IEAction($oButton, "click") ExitLoop EndIf Next EndIf Well, let me ask how to get ElementSetValue <input type = "text" class = "form-control" name = "118b8c9e3a2da6d" style = "text-align: center; font-weight: bold;" placeholder = "Username" aria-label = "Username" aria-describedby = "basic-addon1" required = "">
rm4453 Posted March 1, 2019 Posted March 1, 2019 14 minutes ago, HADE said: Well, let me ask how to get ElementSetValue <input type = "text" class = "form-control" name = "118b8c9e3a2da6d" style = "text-align: center; font-weight: bold;" placeholder = "Username" aria-label = "Username" aria-describedby = "basic-addon1" required = ""> Can you please re-state your question in different words? *A screenshot would help a lot (of the browser inspect element)*
HADE Posted March 1, 2019 Author Posted March 1, 2019 3 minutes ago, rm4453 said: Bạn có thể vui lòng nêu lại câu hỏi của bạn bằng các từ khác nhau? * Ảnh chụp màn hình sẽ giúp ích rất nhiều (của yếu tố kiểm tra trình duyệt) * hee h
HADE Posted March 1, 2019 Author Posted March 1, 2019 3 minutes ago, rm4453 said: Bạn có thể vui lòng nêu lại câu hỏi của bạn bằng các từ khác nhau? * Ảnh chụp màn hình sẽ giúp ích rất nhiều (của yếu tố kiểm tra trình duyệt) * hope you help me
rm4453 Posted March 1, 2019 Posted March 1, 2019 1 minute ago, HADE said: hope you help me I assume you want to input your username into the box?
HADE Posted March 1, 2019 Author Posted March 1, 2019 Just now, rm4453 said: Tôi giả sử bạn muốn nhập tên người dùng của bạn vào hộp? That's right, I want to write my name ("hade1274")
rm4453 Posted March 1, 2019 Posted March 1, 2019 1 minute ago, HADE said: That's right, I want to write my name ("hade1274") Does the Username Field value *name="af39cb3d1c784"* stay the same even if you refresh the page?
rm4453 Posted March 1, 2019 Posted March 1, 2019 (edited) $userField = _IEGetObjByName($oIE, "af39cb3d1c784") ; "af39cb3d1c784" is the name of the username field _IEFormElementSetValue($userField, "hade1274") ; "hade1274" is your username Edited March 1, 2019 by rm4453 commented code
HADE Posted March 1, 2019 Author Posted March 1, 2019 4 minutes ago, rm4453 said: $userField = _IEGetObjByName($oIE, "af39cb3d1c784") ; "af39cb3d1c784" is the name of the username field _IEFormElementSetValue($userField, "hade1274") ; "hade1274" is your username not working please help me #include <IE.au3> Local $oIE = _IECreate("https://viptools.es", 1) _IELoadWait($oIE) Local $oButtons = _IETagNameGetCollection($oIE, "button") If IsObj($oButtons) Then For $oButton In $oButtons If $oButton.getAttribute("data-target") = "#tiktokFollowers" Then _IEAction($oButton, "click") ExitLoop EndIf Next EndIf $userField = _IEGetObjByName($oIE, "62896125e9c95c") ; "af39cb3d1c784" is the name of the username field _IEFormElementSetValue($userField, "hade1274") ; "hade1274" is your username Local $oElements = _IETagNameAllGetCollection($oIE) For $oElement In $oElements If $oElement.classname = 'disableButton btn btn-success' Then $oElement.click() Next
rm4453 Posted March 1, 2019 Posted March 1, 2019 1 minute ago, HADE said: Please Use Code Tags Like Below: #include <IE.au3> Local $oIE = _IECreate("https://viptools.es", 1) _IELoadWait($oIE) Local $oButtons = _IETagNameGetCollection($oIE, "button") If IsObj($oButtons) Then For $oButton In $oButtons If $oButton.getAttribute("data-target") = "#tiktokFollowers" Then _IEAction($oButton, "click") ExitLoop EndIf Next EndIf $userField = _IEGetObjByName($oIE, "62896125e9c95c") ; "af39cb3d1c784" is the name of the username field _IEFormElementSetValue($userField, "hade1274") ; "hade1274" is your username Local $oElements = _IETagNameAllGetCollection($oIE) For $oElement In $oElements If $oElement.classname = 'disableButton btn btn-success' Then $oElement.click() Next
rm4453 Posted March 1, 2019 Posted March 1, 2019 You still haven't answered the question of whether or not the name of the username input field stays the same with webpage refresh
HADE Posted March 1, 2019 Author Posted March 1, 2019 Just now, rm4453 said: You still haven't answered the question of whether or not the name of the username input field stays the same with webpage refresh no
rm4453 Posted March 1, 2019 Posted March 1, 2019 1 minute ago, HADE said: no Are there any other input fields on the page or only that one?
HADE Posted March 1, 2019 Author Posted March 1, 2019 Just now, rm4453 said: Are there any other input fields on the page or only that one? i dont now :3 page: viptools.es
rm4453 Posted March 1, 2019 Posted March 1, 2019 ;===CREDIT=========================== ; ; URL TO SOURCE: https://www.autoitscript.com/forum/topic/136542-ie-automation-get-all-input-fields-and-set-values/ ; CREDIT FOR CODE TO: Robjong ; ;==================================== #include<IE.au3> $sURL = "http://yahoo.com" $oIE = _IECreate($sURL, 0, 1, 1, 1) $colForms = _IEFormGetCollection($oIE) ; get all forms For $oForm In $colForms ; loop over form collection ConsoleWrite("---- FORM " & $oForm.name & " --------------------" & @CRLF) $oFormElements = _IEFormElementGetCollection($oForm) ; get all elements For $oFormElement In $oFormElements ; loop over element collection If StringLower($oFormElement.tagName) == 'input' Then ; it is an input ConsoleWrite("> input." & $oFormElement.type & " " & $oFormElement.name & @CRLF) _IEFormElementSetValue($oFormElement, "Found You", 0) ; set value of the field ElseIf StringLower($oFormElement.tagName) == 'textarea' Then ; it is a textarea ConsoleWrite("> textarea " & $oFormElement.name & @CRLF) _IEFormElementSetValue($oFormElement, "Found You", 0) ; set value of the field EndIf Next Next
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