Search the Community
Showing results for tags 'browser automation'.
-
This is for those pages that seem to load when you use _FFOpenURL(), but they have a text saying "please wait while we load your page..." but according to _FFOpenURL() the page has loaded. An example seen in popular sites is the Cloudflare page saying "Checking your browser before...". It's the opposite of pausing a script until an element is visible on a page. It takes Elements in the form of id, xpath or text search. Global $BrowserPort = 4242 Global $TimeOut = 60000 Global $LocalHost = "127.0.0.1" Func _FFWaitWhileElement($thiselement, $elementtype = "xpath", $timeoutms = 60000) _FFConnect($LocalHost, $BrowserPort, $TimeOut) Local $Element Local $ElementFound = 1 Local $TimeoutCountdown = 0 While $ElementFound <> 0 And $TimeoutCountdown < $timeoutms If $elementtype = "xpath" Then $Element = _FFXPath($thiselement) EndIf If $elementtype = "id" Then Local $ConstructXPath = ".//*[@id='" & $thiselement & "']" $Element = _FFXPath($ConstructXPath) EndIf ; MsgBox(0, "", $Element) Local $ElementXPathTextContent = _FFCmd("FFau3.xpath.textContent") ; MsgBox(0, "", $ElementXPathTextContent) Local $ElementXPathInnerHTML = _FFCmd("FFau3.xpath.innerHTML") ; MsgBox(0, "", $ElementXPathInnerHTML) If $ElementXPathTextContent = "_FFCmd_Err" Or $ElementXPathInnerHTML = "_FFCmd_Err" Then $ElementFound = 0 Else $ElementFound = 1 EndIf If $elementtype = "text" Then $ElementFound = _FFSearch($thiselement) ; MsgBox(0, "", $ElementFound) EndIf $TimeoutCountdown += 1000 _FFDisConnect() _FFConnect($LocalHost, $BrowserPort, $TimeOut) WEnd Return $ElementFound EndFunc _FFConnect($LocalHost, $BrowserPort, $TimeOut) _FFOpenURL("https://www.site.com/page", True) _FFWaitForElement("Please Wait...","text", 60000) MsgBox(0,"","Page finished loading") It's pretty simple, hope it helps some of you who are working with FF.au3 :)
-
Please Spare me for errors M totally Raw At programming stuffs So please forgive me Coming to udf Why was it required: Udf Already Available had to start with an extension and ws a bit tricky to be used also it was a bit obsolute What Are Functionalities of new udf: not much but a better way of interacting and userfriendliness, using external exe which can workaround with many other browsers Requirements: Chromedriver.exe(available freely)(Chrome)(Please Use version 2.28 as further versions/Previous versions sometime create problems) Geckodriver.exe(available freely)(Mozilla FF)There are some problems with this version m working to resolve same and make udf work with both browsers JSON UDF Browserudf.au3 Example Script For facebook Login Quite Simple to use #Include <browserudf.au3> $id=Browser_Setings(9515,"D:\Desktop\Vinfur\chromedriver.exe") $session=Browser_create_session() Browser_openurl($session,"https://www.facebook.com/") $element=Browser_getelement($session,"name","email") browser_setelement($session,$element,"Username type here") $element=Browser_getelement($session,"id","pass") browser_setelement($session,$element,"Password") $element=Browser_getelement($session,"id","u_0_r") browser_actions_click($session,$element) Browser_Setings_close($id) I Know There are thousands of bugs so please go on correcting me so that i will improve and also udf And Also Sorry that i didnt make any error checking mechanism for any function but as i couldnt get all errors listed/documented anywhere so i will update it as we go ahead and one more thanks to
- 65 replies
-
- chrome automation
- browser automation
-
(and 1 more)
Tagged with: