Jump to content

Recommended Posts

Posted
  On 5/27/2022 at 2:09 AM, Danp2 said:

@mLipokYou would use it to validate the current browsing context. For example, it will detect if the target tab has been closed.

Expand  

Will check it.
Thanks.

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

Is there a way to store passwords in browser controled by WD ?
Firefox never ask me to store password.

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

 

Hello, I would like to know if it is possible to take the screenshot of the page but complete it, example I want to capture a table, but this table is a bit long towards the bottom, and if I do it with the following function, it cuts it off since it is not displayed in display the entire table.

$sButton = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//*[@class='tablaPagina']/tbody/tr[2]")
$cResult = _WD_ElementAction($sSession, $sButton, "screenshot")

There is a possibility that I capture the total image that I want without having to move the scroll so that the image is not cropped.

 

 

 

Posted (edited)

Yes it is possible.

 

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted (edited)

Step 1: Use Chrome to save your website as single MHTML file. (you can do the same with Firefox and extensions like "Save Page WE" )
Step 2: Remove all restricted data from the MHTML file.
Step 3: Share the file here.
Step 4: Wait patiently for assistance.

 

Edited by mLipok
patiently added

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted (edited)

Hello I'm trying to use a specific profile using Firefox with WebDriver, but everytime i try it, i see my program freezing while creating the session and then it times out. Before it freezes, i can clearly see the profile did changed, my Firefox favorites bar is not the same.

_WD_Option('Driver', @ScriptDir&'\include\'&(@Compiled?'':'Exe_externe\')&'geckodriver.exe')
_WD_Option('DriverParams', '--log trace ')
_WD_Option('Port', 4444)
$sDesiredCapabilities = '{"capabilities":{"alwaysMatch": {"moz:firefoxOptions": {"args": ["-profile", "C:/Users/USER-06303/Desktop/Firefox profiles"]}}}}'
$oSelf.iWDPid=_WD_Startup()
$oSelf.sWDSession=_WD_CreateSession($sDesiredCapabilities)

Logs :

__WD_Post: URL=HTTP://127.0.0.1:4444/session; $sData={"capabilities":{"alwaysMatch": {"moz:firefoxOptions": {"args": ["-profile", "C:/Users/JOUGLET-06303/Desktop/Firefox profiles"]}}}}
__WD_Post: StatusCode=0; ResponseText=WinHTTP request timed out before Webdriver...
__WD_Post ==> Send / Recv error: WinHTTP request timed out before Webdriver
_WD_CreateSession: WinHTTP request timed out before Webdriver
_WD_CreateSession ==> Webdriver Exception: HTTP status = 0

When i remove the profile part from my '$sDesiredCapabilities' variable, it works fine as usual.

 

Any idea on what is wrong ?

Edited by Keras
forgot result
Posted

Are you sure that

C:/Users/USER-06303/Desktop/Firefox profiles

Exist ?

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

I have my own function for profile dir location.

Try this:

Func _MY__WD_ProfileDir($s_Browser_Name)
    Switch $s_Browser_Name
        Case "chrome"
            Return 'C:\Users\' & @UserName & '\AppData\Local\Google\Chrome\User Data\Default'
        Case "firefox"
            Return @LocalAppDataDir & '\Mozilla\Firefox\Profiles\WD_Testing_Profile'
        Case Else
            Return SetError($_WD_ERROR_NotSupported, @extended, '')
    EndSwitch
EndFunc   ;==>_MY__WD_ProfileDir

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted (edited)

sorry not this topic.

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted
  On 6/1/2022 at 10:33 AM, mLipok said:

I have my own function for profile dir location.

Try this:

Func _MY__WD_ProfileDir($s_Browser_Name)
    Switch $s_Browser_Name
        Case "chrome"
            Return 'C:\Users\' & @UserName & '\AppData\Local\Google\Chrome\User Data\Default'
        Case "firefox"
            Return @LocalAppDataDir & '\Mozilla\Firefox\Profiles\WD_Testing_Profile'
        Case Else
            Return SetError($_WD_ERROR_NotSupported, @extended, '')
    EndSwitch
EndFunc   ;==>_MY__WD_ProfileDir

 

Expand  

How do you use that function ? Could you show me an example ?

Posted
Local $sProfile = _MY__WD_ProfileDir('firefox')
Local $sDesiredCapabilities = '{"capabilities":{"alwaysMatch": {"moz:firefoxOptions": {"args": ["-profile", "' & $sProfile & '"]}}}}'

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

I tried this

WD_Option('Driver', @ScriptDir&'\include\'&(@Compiled?'':'Exe_externe\')&'geckodriver.exe')
_WD_Option('DriverParams', '--log trace ')
_WD_Option('Port', 4444)
$sDesiredCapabilities = '{"capabilities":{"alwaysMatch": {"moz:firefoxOptions": {"args": ["-profile", "C:\Users\'&@UserName&'\Desktop\Firefox profiles"]}}}}'
$oSelf.iWDPid=_WD_Startup()
$oSelf.sWDSession=_WD_CreateSession($sDesiredCapabilities)

Result :

__WD_Post: URL=HTTP://127.0.0.1:4444/session; $sData={"capabilities":{"alwaysMatch": {"moz:firefoxOptions": {"args": ["-profile", "C:\Users\JOUGLET-06303\Desktop\Firefox profiles"]}}}}
__WD_Post: StatusCode=400; ResponseText={"value":{"error":"invalid argument","message":"Failed to decode request as JSON: {\"capabilities\":...
__WD_Post ==> Invalid argument: {"value":{"error":"invalid argument","message":"Failed to decode request as JSON: {\"capabilities\":{\"alwaysMatch\": {\"moz:firefoxOptions\": {\"args\": [\"-profile\", \"C:\\Users\\JOUGLET-06303\\Desktop\\Firefox profiles\"]}}}}","stacktrace":"Syntax error at :1:82"}}
_WD_CreateSession: {"value":{"error":"invalid argument","message":"Failed to decode request as JSON: {\"capabilities\":{\"alwaysMatch\": {\"moz:firefoxOptions\": {\"args\": [\"-profile\", \"C:\\Users\\JOUGLET-06303\\Desktop\\Firefox profiles\"]}}}}","stacktrace":"Syntax error at :1:82"}}
_WD_CreateSession ==> Webdriver Exception: HTTP status = 400

Am i missing something ?

Posted (edited)

I tried another way, 'default' is the name of one of my profiles

$sDesiredCapabilities = '{"capabilities":{"alwaysMatch": {"moz:firefoxOptions": {"args": ["-P", "default"]}}}}'

i'm back to my first issue where Firefox is opened with the right profile but my program freeze and the '_WD_CreateSession($sDesiredCapabilities)' end up timed out :

__WD_Post: URL=HTTP://127.0.0.1:4444/session; $sData={"capabilities":{"alwaysMatch": {"moz:firefoxOptions": {"args": ["-P", "default"]}}}}
__WD_Post: StatusCode=0; ResponseText=WinHTTP request timed out before Webdriver...
__WD_Post ==> Send / Recv error: WinHTTP request timed out before Webdriver
_WD_CreateSession: WinHTTP request timed out before Webdriver
_WD_CreateSession ==> Webdriver Exception: HTTP status = 0

 

Edited by Keras
Posted

Hi Dan,

since the last update of msedgedriver  V102.0.1245.30 the func _WD_GetBrowserVersion("msedge")  shows "Edge" instead of the version. But I think, it is not a problem of the func but of msedgedriver!?

Posted

@HJL I just tested it here and it worked as expected for me.

$sResult = _WD_GetBrowserVersion('msedge')
    ;### Debug CONSOLE ↓↓↓
    ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $sResult = ' & $sResult & @CRLF & '>Error code: ' & @error & @CRLF)

This is the console output --

_WD_GetBrowserPath ==> Success (0 / 2)
_WD_GetBrowserVersion ==> Success (0 / 2)
@@ Debug(774) : $sResult = 102.0.1245.30
>Error code: 0

Are you sure that you are running the most recent UDF version?

Posted

Is there a way to get the handle or PID of the browser started by the webdriver ?
At the moment I am using WinList, but this could potentially return handles I am not looking for.

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...