-
Posts
266 -
Joined
-
Last visited
About Jury
- Birthday 01/01/1947
Profile Information
-
Location
London Engalnd
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
Jury's Achievements
-
I've added more information to my original post below.
-
Global $_WD_DRIVER, $aElements, $dateIn, $Date_long_format, $BAILIIcite, $ncn, $xHTML, $cite Local $sDesiredCapabilities $_WD_DEBUG = $_WD_DEBUG_None $ioc_clip = ClipGet() SetupGecko() _WD_Startup() $sSession = _WD_CreateSession($sDesiredCapabilities) For $page = 0 To 13 _WD_Navigate($sSession, $ioc_clip & '&page=' & $page) $Handle = _WD_Window($sSession, 'window', '') Sleep(1000) $sHTML = _WD_GetSource($sSession) $sHTML2 = StringRegExpReplace($sHTML, '<strong>(.*?)</strong>', '\1') Sleep(1000) Local $aArray = StringRegExp($sHTML2, '<a class="block group" href="(.*?(ic-\w+)-\w+/)">.*?light">(.*?)</h4>.*?(\d+ \w+ (\d{4}))[\s,-]+(.*?)</p>((?s).*?(?-s)class="p-1 inline-block ml-2" style="background-color: ;">.*?</span></li></ul>).*?', 4) $cite = $aArray[2] check_citation($cite) Next _WD_DeleteSession($sSession) _WD_Shutdown() Exit Func SetupGecko() _WD_Option('Driver', $resources & 'geckodriver.exe') _WD_Option('Port', 4444) $sDesiredCapabilities = '{"desiredCapabilities":{"javascriptEnabled":true,"nativeEvents":true,"acceptInsecureCerts":true}}' EndFunc ;==>SetupGecko Func check_citation($ncn) _WD_Navigate($sSession, 'https://..../check...=' & $ncn & '&urlonly') $Handle = _WD_Window($sSession, 'window', '') $xHTML = _WD_GetSource($sSession) If StringInStr($xHTML, "/cases/") Then Sleep(2000) ConsoleWrite('On: ' & $cite & @CRLF) Else ConsoleWrite('NotI: ' & $cite & @CRLF) EndIf EndFunc ;==>check_citation I'm running a WD_DRIVER session which contains a function that also contains another WD_DRIVER session to another website - both need to continue to be open is this possible if so how do I identify the second session (within the function)?
-
Haven't got any output legible yet tried to replace " " with hex A0s thinking that would preserve spacing so the result would work in a <pre> </pre> section in a html file but its a mess. It seems that there would have to be differing types of $sSeparator if it is going to output a html table such as the attached test.html the added advantage is this can be done is that the resultant html table can be copy and pasted into Word files (as I've done in word_table.docx). test.htmlword_table.docx
-
Any hints on changing out put to <table> format for html documents? I'm struggling to understand $sSeparator in _StringToTable. Is this possible even?
-
Today my Firefox scripts started returning HTTP method not allowed: _WD_IsLatestRelease ==> Success (0) : False _WD_Startup: OS: WIN_10 WIN32_NT 19045 _WD_Startup: AutoIt: 3.3.14.5 _WD_Startup: Webdriver UDF: 0.8.1 (Update available) _WD_Startup: WinHTTP: 1.6.4.2 _WD_Startup: Driver: C:\Users\joeur\Documents\AutoIt_code/geckodriver.exe (32 Bit) _WD_Startup: Params: _WD_Startup: Port: 4444 _WD_Startup: Command: "C:\Users\joeur\Documents\AutoIt_code/geckodriver.exe" __WD_Post: URL=HTTP://127.0.0.1:4444/session; $sData={"desiredCapabilities":{"javascriptEnabled":true,"nativeEvents":true,"acceptInsecureCerts":true}} __WD_Post ==> Invalid argument (5) HTTP status = 400 : ResponseText={"value":{"error":"invalid argument","message":"missing field `capabilities`","stacktrace":""}}... _WD_CreateSession: {"value":{"error":"invalid argument","message":"missing field `capabilities`","stacktrace":""}} _WD_CreateSession ==> Webdriver Exception (10) HTTP status = 400 __WD_Post: URL=HTTP://127.0.0.1:4444/session//url; $sData={"url":"https://www.catribunal.org.uk"} __WD_Post ==> Unknown Command (16) HTTP status = 405 : ResponseText=HTTP method not allowed... _WD_Navigate ==> Unknown Command (16) HTTP status = 405 : HTTP method not allowed __WD_Post: URL=HTTP://127.0.0.1:4444/session//window/maximize; $sData={} __WD_Post ==> Unknown Command (16) HTTP status = 405 : ResponseText=HTTP method not allowed... _WD_Window ==> Unknown Command (16) HTTP status = 405 : : Response=HTTP method not allowed... __WD_Post: URL=HTTP://127.0.0.1:4444/session//elements; $sData={"using":"xpath","value":"//table[@id='table%20alfresco-table']/tbody/tr"} __WD_Post ==> Unknown Command (16) HTTP status = 405 : ResponseText=HTTP method not allowed... _WD_FindElement ==> Unknown Command (16) HTTP status = 405 : HTTP method not allowed _WD_GetTable ==> Unknown Command (16) HTTP status = 405 __WD_Post: URL=HTTP://127.0.0.1:4444/session//element; $sData={"using":"xpath","value":"//a[@id='table%20alfresco-table'][not(@disabled)]"} __WD_Post ==> Unknown Command (16) HTTP status = 405 : ResponseText=HTTP method not allowed... _WD_FindElement ==> Unknown Command (16) HTTP status = 405 : HTTP method not allowed __WD_Delete: URL=HTTP://127.0.0.1:4444/session/ __WD_Delete ==> Unknown Command (16) HTTP status = 405 : ResponseText=HTTP method not allowed... _WD_DeleteSession ==> Webdriver Exception (10) HTTP status = 405 : HTTP method not allowed I've updated both Webdriver UDF and geckodriver.exe #include "wd_helper.au3" #include "wd_helper.au3" #include "wd_core.au3" #include <Array.au3> #include <Date.au3> Global $_WD_DRIVER, $_WD_READYSTATE_Interactive Local $sDesiredCapabilities $resources = @MyDocumentsDir & '\AutoIt_code\getter\resources\' SetupGecko() _WD_Startup() $sSession = _WD_CreateSession($sDesiredCapabilities) _WD_Navigate($sSession, 'https://www.catribunal.org.uk') ;$Handle = _WD_Window($sSession, 'window', '') _WD_Window($sSession, "Maximize") Local $aResult = _WD_GetTable($sSession, "//table[@id='table%20alfresco-table']") $aElements = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//a[@id='table%20alfresco-table'][not(@disabled)]") _ArrayDisplay($aResult) Sleep(5000) _WD_DeleteSession($sSession) _WD_Shutdown() Func SetupGecko() _WD_Option('Driver', @ScriptDir & '/geckodriver.exe') ;_WDOption('DriverParams', '--log trace') _WD_Option('Port', 4444) $sDesiredCapabilities = '{"desiredCapabilities":{"javascriptEnabled":true,"nativeEvents":true,"acceptInsecureCerts":true}}' ;$sDesiredCapabilities = '{"desiredCapabilities":{"javascriptEnabled":true,"nativeEvents":true,"acceptInsecureCerts":true, {"browserOptions": --binary C:\Program Files (x86)\Mozilla Firefox\firefox.exe, "browserName": firefox, "browserVersion": 59.0.1}}}' EndFunc ;==>SetupGecko
-
ioa747 reacted to a post in a topic:
_GUICtrlButton_SetSplitInfo
-
Works fine for me : ----------------------------- WM_NOTIFY - Infos: ----------------------------- Code :-1249 CtrlID :10001 CtrlHWnd:0x000308F2 Split Button 2 $BCN_HOTITEMCHANGE - Leaving: ----------------------------- WM_NOTIFY - Infos: ----------------------------- Code :-1249 CtrlID :10001 CtrlHWnd:0x000308F2 Split Button 2.... ------------------------------------- Split Info ---------------- $ainfo[0] = 0x00000036 $ainfo[1] = 4 $ainfo[2] = 15 $ainfo[3] = 0 Split Info ---------------- $BCN_HOTITEMCHANGE - Entering: ----------------------------- WM_NOTIFY - Infos: ----------------------------- Code :-1249 CtrlID :10001 CtrlHWnd:0x000308F2 Split Button 2....
-
Danp2 reacted to a post in a topic:
_WD_GetSource BINARY
-
Thanks again - has it been that long! I'm getting old fast.
-
Thanks mLipok & Danp2, _WD_DownloadFile? I can't locate that function in my _WD lists - where is it and does it down load in binary? I can use InetGet or _INetGetSource but want to do it all via _WD as a demonstration.
-
Using _WD_GetSource is it possible to retrieve the file as binary?
-
WebDriver UDF - Help & Support (IV)
Jury replied to Danp2's topic in AutoIt General Help and Support
It all works ok but it downloads just the first item three times (or two if I start with 1. Sorry &processing is my directory I use for such things and ecjurls.txt is located there. -
WebDriver UDF - Help & Support (IV)
Jury replied to Danp2's topic in AutoIt General Help and Support
When I run the following script on just one item (file attached) in the array: For $i = 1 To 1 ;UBound($urlsArray) - 1 it works fine but when I try to run it for the whole array: For $i = 1 To UBound($urlsArray) - 1 it dosen't work seems to do with _WD_Navigate not getting the next session. What I'm I doing wrong . Thanks for any help. Joe SetupGecko() _WD_Startup() $sSession = _WD_CreateSession($sDesiredCapabilities) $urlsArray = FileReadToArray($processing & 'ecjurls.txt') For $i = 1 To UBound($urlsArray) - 1 $urlsArray[$i] = StringReplace($urlsArray[$i], '"', '%22') $urlsArray[$i] = StringRegExpReplace($urlsArray[$i], '^.*?#\{(.*?)$', 'http://hudoc.echr.coe.int/#{%22tabview%22:[%22document%22],$1') ConsoleWrite($urlsArray[$i] & @CRLF) _WD_Navigate($sSession, $urlsArray[$i]) _WD_LoadWait($sSession, 5000, 15000) _WD_GetElementById($sSession, "results-list") $sHTML2 = _WD_GetSource($sSession) $file1 = FileOpen($out & $i & ".html", 258) If $file1 = -1 Then MsgBox(0, "Error", "Unable to open file: " & $out & "ECHR_" & $i & ".html") Exit EndIf FileWrite($file1, $sHTML2) FileClose($file1) Next _WD_DeleteSession($sSession) _WD_Shutdown() ecjurls.txt -
Thanks of all the various links I missed this very helpful page. Joe
-
I've been trying to find the WD equivalent to _IEGetObjById my old code used this: $oDiv = _IEGetObjById($oIE, "results-list") _IEAction($oDiv, "focus") $sHTML = $oDiv.outerHTML I'm trying to download the html of individual cases found here: http://hudoc.echr.coe.int/# please give me a hint. Joe
-
WinHttp.WinHttpRequest.5.1 - Need help to get HTML
Jury replied to dersiniar's topic in AutoIt General Help and Support
What's the $URL ? -
WinHttp.WinHttpRequest.5.1 - Need help to get HTML
Jury replied to dersiniar's topic in AutoIt General Help and Support
Use this and ope a file and write the $sData to it. $dData = InetRead($URL, 3) $sData = BinaryToString($dData)