Jump to content

WebDriver UDF (W3C compliant version) - 2024/09/21


Danp2
 Share

Recommended Posts

Hi @Danp2

I m trying to use the function _WD_Screenshot , the capture seem to be to the right dimension but the image i get on my folder is totally black

Here is my code : 

; Name ..........: _WD_Screenshot
; Description ...:
; Syntax ........: _WD_Screenshot($sSession[, $sElement = ''[, $nOutputType = 1]])
; Parameters ....: $sSession            - Session ID from _WDCreateSession
;                  $sElement            - [optional] Element ID from _WDFindElement
;                  $nOutputType         - [optional] One of the following output types:
;                               | 1 - String (Default)
;                               | 2 - Binary
;                               | 3 - Base64

 

$ObjScreenShot = _WD_Screenshot($sSession)

    $FileName = "Test.png"
    $FilePath = FileOpen(@ScriptDir & "\ScreenShots\" & $FileName, 18) ; is another value i should use instead of 18 ?
    FileWrite($FilePath, $ObjScreenShot)
    FileClose($FilePath)


Can you tell me if my parameter are corrects, perhaps my parameters aren t on encoding ?
If not , can you tell me what paramer i should use on  _WD_Screenshot and on  FileOpen to get the image.

Can you tell us what should I use if I want screenshot on jpg format ?

Great Thanks for all 
 

Link to comment
Share on other sites

Hi Dan !
 

I Inserted my code on the  function  Demonavigation  and created a folder with the name "Screenshot" on my scripts directory.

I Joined : 

a) A runable exemple
b) the image I got

And here is  my output on scythe  : 

URL=https://consent.yahoo.com/collectConsent?sessionId=3_cc-session_bd6243e0-7530-4e8f-8d78-31c665bb9fc5&lang=fr-FR&inline=false
__WD_Get: URL=HTTP://127.0.0.1:9515/session/6fa80a09794121a4f812337185b20882/screenshot
__WD_Get: StatusCode=200; $iResult = 0; $sResponseText={"value":"iVBORw0KGgoAAAANSUhEUgAAB0gAAAb0CAYAAAByDkDwAAAAAXNSR0IArs4c6QAAIABJREFUeJzswQEBAAAAgJD+r+...
_WD_Window: {"value":"iVBORw0KGgoAAAANSUhEUgAAB0gAAAb0CAYAAAByDkDwAAAAAXNSR0IArs4c6QAAIABJREFUeJzswQEBAAAAgJD+r+...
_WD_Screenshot ==> Success

I still don't undestand why the capture is totally black.
In my example i m expecting to get a screen capture with the yahoo screens

Great Thanks for your help.

 

 

 

Test.png

wd_demo.au3

Link to comment
Share on other sites

I not found option with class name. Is it possible like this: 

C# Code: 

Urls = Browser.FindElements(By.ClassName("entryLink"));

I want receive 100 links froms this url:

but my example with partial link not work :(

$sArLinks = _WD_FindElement($sSession, $_WD_LOCATOR_ByPartialLinkText, "clubtone.net/music", "", "True")

 

Link to comment
Share on other sites

28 minutes ago, Danp2 said:

@rocije9440 "clubtone.net/music" is from the URL, not the link's text. Therefore, you can't use $_WD_LOCATOR_ByPartialLinkText.

Try it with an xpath of '//a[@class="entryLink"]'

 

Tkank you! It's work, but I collect array of 100 lines like this "element-6066-11e4-a52e-4f735466cecf":"98f5f1c2-d5ba-441c-94c2-6fd245dfc4ea", how convert them to normal links?

Link to comment
Share on other sites



I downloaded the latest webdriver and got the same result

Do you think i need also the latest version of  WinHttpConstants.au3 ?

Can you tell us where you found the latest version of winhttp udf because the link on your requirement  in  your udf description is pointing to the version 1.6.4.1

 

Thanks for all

log2.txt

Link to comment
Share on other sites

@rocije9440 You have to retrieve the associated URL using _WD_ElementAction --

$sArLinks = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, '//a[@class="entryLink"]', "", "True")

For $sLink IN $sArLinks
    $sHref = _WD_ElementAction($sSession, $sLink, "attribute", "href")
    ; Do something here with retrieved value
Next

 

Link to comment
Share on other sites

@danylarson v1.6.4.1 of the WinHTTP UDF was released almost three years ago. Since that time, some needed changes have been made to WinHttp.au3 but there hasn't been a "official" release made by @trancexx. AFAICS, the only change that's been made to WinHttpConstants.au3 is the updated copyright info, but grabbing the latest version wouldn't hurt anything.

Have you tried testing with either Firefox or Edge? Can you post the screen capture file here so that we can download / view it's contents?

Link to comment
Share on other sites

Hi there,
with webdriver Firefox starts with a window the size of the last start, Chrome and Edge start with a window that is too narrow for me, only half the screen. How can I make the windows larger beforehand? With $sDesiredCapabilities?

And Chrome and Edge have a bar at the top "Microsoft Edge (or Chrome) is controlled by automated test software." Is there a way to get the bar off?

And is there a web driver for Opera? How does the setup work?

Thanks for your help - It's great that you developed this UDF!

Hans

Balken_Testsoftware.png

Link to comment
Share on other sites

  • Danp2 changed the title to WebDriver UDF (W3C compliant version) - 2024/09/21
  • Melba23 pinned this topic

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...