Moi Posted May 9, 2020 Posted May 9, 2020 hello i have a script and i want to have the new html when i validate . How to refresh $oIE for continue request Local $oIE = _IECreate("http://speedosurf.com/compte/login") sleep(1000) $Input_Name = _IEGetObjByName($oIE, "pseudo") _IEFormElementSetValue($Input_Name, "test") $Input_Name = _IEGetObjByName($oIE, "pass") _IEFormElementSetValue($Input_Name, "test") sleep(1000) $oElements = _IETagNameGetCollection($oIE, "button") For $oElement in $oElements If $oElement.type = "submit" Then _IEAction($oElement, "click") Exitloop EndIf Next
Moi Posted May 9, 2020 Author Posted May 9, 2020 i want to have the source of "http://speedosurf.com/compte/index"
Moi Posted May 9, 2020 Author Posted May 9, 2020 really sorry for my english, but i wish i could have access to the source code of the validated page
Danp2 Posted May 10, 2020 Posted May 10, 2020 It's not really clear to me what the issue is. Perhaps you need to add a call to _IELoadWait? Latest Webdriver UDF Release Webdriver Wiki FAQs
Moi Posted May 10, 2020 Author Posted May 10, 2020 (edited) sorry, in fact after i click, i want to load the new source of $oIE Edited May 10, 2020 by Moi
Nine Posted May 10, 2020 Posted May 10, 2020 Maybe this is what you want : #include <Constants.au3> #include <IE.au3> Local $oIE = _IECreate("http://speedosurf.com/compte/login") $Input_Name = _IEGetObjByName($oIE, "pseudo") _IEFormElementSetValue($Input_Name, "test") $Input_Name = _IEGetObjByName($oIE, "pass") _IEFormElementSetValue($Input_Name, "test") sleep(1000) $bFound = False $oElements = _IETagNameGetCollection($oIE, "button") For $oElement in $oElements If $oElement.type = "submit" Then $bFound = True _IEAction($oElement, "click") Exitloop EndIf Next If Not $bFound Then Exit MsgBox ($MB_SYSTEMMODAL,"Erreur","Unable to find submit button") _IELoadWait ($oIE) $sHTML = _IEBodyReadHTML ($oIE) ConsoleWrite ($sHTML & @CRLF) “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
Moi Posted May 10, 2020 Author Posted May 10, 2020 ok nice. thanks after i want to use Local $sMyString = "surfer" Local $oLinks = _IELinkGetCollection($oIE) For $oLink In $oLinks Local $sLinkText = _IEPropertyGet($oLink, "innerText") If StringInStr($sLinkText, $sMyString) Then _IEAction($oLink, "click") ExitLoop EndIf Next how i can use $oIE with $sHTML ?
Nine Posted May 10, 2020 Posted May 10, 2020 Oh, I see what you mean. You don't have to do anything. $oIE is "refreshed" automatically since it is an object aiming a specific IE instance. Just make sure, after the click, you wait till the page is fully loaded as I have shown you before. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
Moi Posted May 10, 2020 Author Posted May 10, 2020 for me $oIE isn't refreshed and i don't understand why...
Nine Posted May 10, 2020 Posted May 10, 2020 Put together the 2 parts, and post your code here, so we can look at it. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
Moi Posted May 10, 2020 Author Posted May 10, 2020 #include <Constants.au3> #include <IE.au3> Local $oIE1 = _IECreate("http://speedosurf.com/compte/login") if _IEGetObjByName($oIE1, "pseudo")<>"" Then $Input_Name = _IEGetObjByName($oIE1, "pseudo") _IEFormElementSetValue($Input_Name, "test") $Input_Name = _IEGetObjByName($oIE1, "pass") _IEFormElementSetValue($Input_Name, "test") sleep(1000) $oElements = _IETagNameGetCollection($oIE1, "button") For $oElement in $oElements If $oElement.type = "submit" Then _IEAction($oElement, "click") EndIf Next sleep(1000) Local $oIE = _IECreate("http://speedosurf.com/surf") Else Local $oIE = _IECreate("http://speedosurf.com/surf") EndIf _IEQuit($oIE1) $oElements = _IETagNameGetCollection($oIE, "button") For $oElement in $oElements ConsoleWrite ( $oElement.innertext &@crlf) if StringInStr($oElement.innertext,"marrer le Surf",True) Then _IEAction($oElement, "click") EndIf Next this is the complete code but for working i run another _IECreate
Nine Posted May 10, 2020 Posted May 10, 2020 Here should work better this way : expandcollapse popup#include <Constants.au3> #include <IE.au3> Local $oIE = _IECreate("http://speedosurf.com/compte/login") $Input_Name = _IEGetObjByName($oIE, "pseudo") If @error Then Exit MsgBox($MB_SYSTEMMODAL, "", "Unable to find pseduo") _IEFormElementSetValue($Input_Name, "test") $Input_Name = _IEGetObjByName($oIE, "pass") _IEFormElementSetValue($Input_Name, "test") Sleep(1000) $bFound = False $oElements = _IETagNameGetCollection($oIE, "button") For $oElement In $oElements If $oElement.type = "submit" Then $bFound = True _IEAction($oElement, "click") ExitLoop EndIf Next If Not $bFound Then Exit MsgBox($MB_SYSTEMMODAL, "Erreur", "Unable to find submit button") _IELoadWait($oIE) $bFound = False $oElements = _IETagNameGetCollection($oIE, "button") For $oElement In $oElements ConsoleWrite($oElement.innertext & @CRLF) If StringInStr($oElement.innertext, "marrer le Surf", True) Then $bFound = True _IEAction($oElement, "click") ExitLoop EndIf Next If Not $bFound Then Exit MsgBox($MB_SYSTEMMODAL, "Erreur", "Unable to find Démarrer le Surf") _IELoadWait($oIE) ; continue ton script _IEQuit($oIE) Untested “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
Nine Posted May 10, 2020 Posted May 10, 2020 Ok, I found the problem. The site creates a new object for each page. So the old $oIE refers to the previous page. You need to attach to the new page like this : expandcollapse popup#include <Constants.au3> #include <IE.au3> #include <Array.au3> Local $oIE = _IECreate("http://speedosurf.com/compte/login") $Input_Name = _IEGetObjByName($oIE, "pseudo") If @error Then Exit MsgBox($MB_SYSTEMMODAL, "", "Unable to find pseduo") _IEFormElementSetValue($Input_Name, "LoginName") $Input_Name = _IEGetObjByName($oIE, "pass") _IEFormElementSetValue($Input_Name, "MyPassword") Sleep(1000) $bFound = False $oElements = _IETagNameGetCollection($oIE, "button") For $oElement In $oElements If $oElement.type = "submit" Then $bFound = True _IEAction($oElement, "click") ExitLoop EndIf Next If Not $bFound Then Exit MsgBox($MB_SYSTEMMODAL, "Erreur", "Unable to find submit button") _IELoadWait($oIE) Sleep (3000) $oIE = _IEAttach ("Compte", "title") $bFound = False Local $sMyString = "Surfer" Local $oLinks = _IETagNameGetCollection($oIE, "a") For $oLink In $oLinks Local $sLinkText = _IEPropertyGet($oLink, "innerText") ConsoleWrite ($sLinkText & @CRLF) If StringInStr($sLinkText, $sMyString) Then _IEAction($oLink, "click") $bFound = True ExitLoop EndIf Next If Not $bFound Then Exit MsgBox($MB_SYSTEMMODAL, "Erreur", "Unable to find Surfer link") _IELoadWait($oIE) Sleep (3000) $oIE = _IEAttach ("Surfer", "title") $bFound = False $oElements = _IETagNameGetCollection($oIE, "button") For $oElement In $oElements ConsoleWrite($oElement.innertext & @CRLF) If StringInStr($oElement.innertext, "marrer le Surf", True) Then $bFound = True _IEAction($oElement, "click") ExitLoop EndIf Next If Not $bFound Then Exit MsgBox($MB_SYSTEMMODAL, "Erreur", "Unable to find Démarrer le Surf") _IELoadWait($oIE) ; continue ton script ;_IEQuit($oIE) “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
Moi Posted May 10, 2020 Author Posted May 10, 2020 merci super boulot, maintenant faut que je comprenne les mecanismes
Nine Posted May 10, 2020 Posted May 10, 2020 glad i could help. In English for now on (google translate is not bad at all) “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
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