Jump to content

Recommended Posts

Posted (edited)

So today few times I get:
 

  Quote

__WD_Post: StatusCode=400; ResponseText={"value":{"error":"invalid argument","message":"invalid argument: user data directory is already in ...

__WD_Post ==> Invalid argument: {"value":{"error":"invalid argument","message":"invalid argument: user data directory is already in use, please specify a unique value for --user-data-dir argument, or don't use --user-data-dir","stacktrace":"Backtrace:\n\tOrdinal0 [0x01096903+2517251]\n\tOrdinal0 [0x0102F8E1+2095329]\n\tOrdinal0 [0x00F32848+1058888]\n\tOrdinal0 [0x00F4D8AB+1169579]\n\tOrdinal0 [0x00F4A2CF+1155791]\n\tOrdinal0 [0x00F7AAAF+1354415]\n\tOrdinal0 [0x00F7A71A+1353498]\n\tOrdinal0 [0x00F7639B+1336219]\n\tOrdinal0 [0x00F527A7+1189799]\n\tOrdinal0 [0x00F53609+1193481]\n\tGetHandleVerifier [0x01225904+1577972]\n\tGetHandleVerifier [0x012D0B97+2279047]\n\tGetHandleVerifier [0x01126D09+534521]\n\tGetHandleVerifier [0x01125DB9+530601]\n\tOrdinal0 [0x01034FF9+2117625]\n\tOrdinal0 [0x010398A8+2136232]\n\tOrdinal0 [0x010399E2+2136546]\n\tOrdinal0 [0x01043541+2176321]\n\tBaseThreadInitThunk [0x75B3FA29+25]\n\tRtlGetAppContainerNamedObjectPath [0x77037A9E+286]\n\tRtlGetAppContainerNamedObjectPath [0x77037A6E+238]\n"}}


_WD_CreateSession: {"value":{"error":"invalid argument","message":"invalid argument: user data directory is already in use, please specify a unique value for --user-data-dir argument, or don't use --user-data-dir","stacktrace":"Backtrace:\n\tOrdinal0 [0x01096903+2517251]\n\tOrdinal0 [0x0102F8E1+2095329]\n\tOrdinal0 [0x00F32848+1058888]\n\tOrdinal0 [0x00F4D8AB+1169579]\n\tOrdinal0 [0x00F4A2CF+1155791]\n\tOrdinal0 [0x00F7AAAF+1354415]\n\tOrdinal0 [0x00F7A71A+1353498]\n\tOrdinal0 [0x00F7639B+1336219]\n\tOrdinal0 [0x00F527A7+1189799]\n\tOrdinal0 [0x00F53609+1193481]\n\tGetHandleVerifier [0x01225904+1577972]\n\tGetHandleVerifier [0x012D0B97+2279047]\n\tGetHandleVerifier [0x01126D09+534521]\n\tGetHandleVerifier [0x01125DB9+530601]\n\tOrdinal0 [0x01034FF9+2117625]\n\tOrdinal0 [0x010398A8+2136232]\n\tOrdinal0 [0x010399E2+2136546]\n\tOrdinal0 [0x01043541+2176321]\n\tBaseThreadInitThunk [0x75B3FA29+25]\n\tRtlGetAppContainerNamedObjectPath [0x77037A9E+286]\n\tRtlGetAppContainerNamedObjectPath [0x77037A6E+238]\n"}}
_WD_CreateSession ==> Webdriver Exception: HTTP status = 400
 

Expand  

and program exits due to @error handling.

but few attempts later:
 

  Quote

_WD_IsLatestRelease: True
_WD_IsLatestRelease ==> Success
_WD_Startup: OS:    WIN_10 WIN32_NT 19044 
_WD_Startup: AutoIt:    3.3.15.5
_WD_Startup: WD.au3:    0.5.0.3 (Up to date)
_WD_Startup: WinHTTP:    1.6.4.2
_WD_Startup: Driver:    chromedriver.exe
_WD_Startup: Params:    
_WD_Startup: Port:    9515
__WD_Post: URL=HTTP://127.0.0.1:9515/session; $sData={
    "capabilities":{
        "alwaysMatch":{
            "acceptInsecureCerts":true
        },
        "firstMatch":[
            {
                "browserName":"chrome",
                "goog:chromeOptions":{
                    "w3c":true,
                    "args":[
                        "user-agent=Mozilla\/5.0 (Windows NT 10.0; Win64; X64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/96.0.4664.110 Safari\/537.36",
                        "user-data-dir=C:\\Users\\Szef\\AppData\\Local\\Google\\Chrome\\User Data\\Default",
                        "--profile-directory=default",
                        "start-maximized",
                        "disable-infobars",
                        "--no-sandbox",
                        "--disable-blink-features=AutomationControlled",
                        "--disable-web-security",
                        "--allow-running-insecure-content",
                        "--ignore-certificate-errors",
                        "--headless"
                    ],
                    "prefs":{
                        "credentials_enable_service":false,
                        "download.default_directory":"Z:\\!!!_SVN_AU3\\UDF_ML\\Testing\\TESTING_DOWNLOAD"
                    },
                    "excludeSwitches":[
                        "disable-popup-blocking",
                        "enable-automation",
                        "load-extension"
                    ]
                }
            }
        ]
    }
}
__WD_Post: StatusCode=200; ResponseText={"value":{"capabilities":{"acceptInsecureCerts":true,"browserName":"chrome","browserVersion":"96.0.4...
_WD_CreateSession: {"value":{"capabilities":{"acceptInsecureCerts":true,"browserName":"chrome","browserVersion":"96.0.4664.110","chrome":{"chromedriverVersion":"96.0.4664.45 (76e4c1bb2ab4671b8beba3444e61c0f17584b2fc-refs/branch-heads/4664@{#947})","userDataDir":"C:\\Users\\Szef\\AppData\\Local\\Google\\Chrome\\User Data\\Default"},"goog:chromeOptions":{"debuggerAddress":"localhost:62223"},"networkConnectionEnabled":false,"pageLoadStrategy":"normal","platformName":"windows","proxy":{},"setWindowRect":true,"strictFileInteractability":false,"timeouts":{"implicit":0,"pageLoad":300000,"script":30000},"unhandledPromptBehavior":"dismiss and notify","webauthn:extension:credBlob":true,"webauthn:extension:largeBlob":true,"webauthn:virtualAuthenticators":true},"sessionId":"f7c8d4bea5f711c49040338825cc8c75"}}
__WD_Post: URL=HTTP://127.0.0.1:9515/session/f7c8d4bea5f711c49040338825cc8c75/execute/sync; $sData={"script":"return window.devicePixelRatio", "args":[]}
__WD_Post: StatusCode=200; ResponseText={"value":1}...
_WD_ExecuteScript: {"value":1}...
_WD_ExecuteScript ==> Success: HTTP status = 200
__WD_Post: URL=HTTP://127.0.0.1:9515/session/f7c8d4bea5f711c49040338825cc8c75/url; $sData={"url":"************************"}
__WD_Post: StatusCode=200; ResponseText={"value":null}...
_WD_Navigate: {"value":null}
__WD_Post: URL=HTTP://127.0.0.1:9515/session/f7c8d4bea5f711c49040338825cc8c75/execute/sync; $sData={"script":"return document.readyState", "args":[]}
__WD_Post: StatusCode=200; ResponseText={"value":"complete"}...
_WD_ExecuteScript: {"value":"complete"}...
_WD_ExecuteScript ==> Success: HTTP status = 200
__WD_Post: URL=HTTP://127.0.0.1:9515/session/f7c8d4bea5f711c49040338825cc8c75/element; $sData={"using":"css selector","value":"#nkw .clear-book"}
__WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"ea97d80d-2456-443d-9609-ff0598171e48"}}...
_WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"ea97d80d-2456-443d-9609-ff0598171e48"}}
__WD_Get: URL=HTTP://127.0.0.1:9515/session/f7c8d4bea5f711c49040338825cc8c75/element/ea97d80d-2456-443d-9609-ff0598171e48/displayed
__WD_Get: StatusCode=200; $iResult = 0; $sResponseText={"value":true}...
_WD_ElementAction: {"value":true}...
__WD_Get: URL=HTTP://127.0.0.1:9515/session/f7c8d4bea5f711c49040338825cc8c75/element/ea97d80d-2456-443d-9609-ff0598171e48/enabled
__WD_Get: StatusCode=200; $iResult = 0; $sResponseText={"value":true}...
_WD_ElementAction: {"value":true}...
_WD_WaitElement ==> Success
__WD_Post: URL=HTTP://127.0.0.1:9515/session/f7c8d4bea5f711c49040338825cc8c75/element/ea97d80d-2456-443d-9609-ff0598171e48/click; $sData={"id":"ea97d80d-2456-443d-9609-ff0598171e48"}
__WD_Post: StatusCode=200; ResponseText={"value":null}...
_WD_ElementAction: {"value":null}...
__WD_Post: URL=HTTP://127.0.0.1:9515/session/f7c8d4bea5f711c49040338825cc8c75/element; $sData={"using":"css selector","value":"select#kodWydzialu"}
__WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"5e420b4e-5271-4c2a-af2a-a6680e4bcb56"}}...
_WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"5e420b4e-5271-4c2a-af2a-a6680e4bcb56"}}
__WD_Get: URL=HTTP://127.0.0.1:9515/session/f7c8d4bea5f711c49040338825cc8c75/element/5e420b4e-5271-4c2a-af2a-a6680e4bcb56/property/nodeName
__WD_Get: StatusCode=200; $iResult = 0; $sResponseText={"value":"SELECT"}...
_WD_ElementAction: {"value":"SELECT"}...
__WD_Get: URL=HTTP://127.0.0.1:9515/session/f7c8d4bea5f711c49040338825cc8c75/element/5e420b4e-5271-4c2a-af2a-a6680e4bcb56/property/outerHTML
__WD_Get: StatusCode=200; $iResult = 0; $sResponseText={"value":"\u003Cselect id=\"kodWydzialu\" name=\"kodEci\" class=\"required hide\">\n                ...
_WD_ElementAction: {"value":"\u003Cselect id=\"kodWydzialu\" name=\"kodEci\" class=\"required hide\">\n                ...
_WD_ElementSelectAction: (array)
_WD_ElementSelectAction ==> Success
__WD_Post: URL=HTTP://127.0.0.1:9515/session/f7c8d4bea5f711c49040338825cc8c75/element; $sData={"using":"css selector","value":"select#kodWydzialu ~ input"}
__WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"acc86ed7-f0e4-4e84-854e-a0b58fe49bbe"}}...
_WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"acc86ed7-f0e4-4e84-854e-a0b58fe49bbe"}}
__WD_Post: URL=HTTP://127.0.0.1:9515/session/f7c8d4bea5f711c49040338825cc8c75/element/acc86ed7-f0e4-4e84-854e-a0b58fe49bbe/value; $sData={"id":"acc86ed7-f0e4-4e84-854e-a0b58fe49bbe", "text":"KA1P"}
__WD_Post: StatusCode=200; ResponseText={"value":null}...
_WD_ElementAction: {"value":null}...
__WD_Post: URL=HTTP://127.0.0.1:9515/session/f7c8d4bea5f711c49040338825cc8c75/element; $sData={"using":"xpath","value":"//*[@id='numerKsiegiWieczystej']"}
__WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"e83ca5de-de7d-4a0d-80fb-a96b827a8868"}}...
_WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"e83ca5de-de7d-4a0d-80fb-a96b827a8868"}}
__WD_Get: URL=HTTP://127.0.0.1:9515/session/f7c8d4bea5f711c49040338825cc8c75/element/e83ca5de-de7d-4a0d-80fb-a96b827a8868/displayed
__WD_Get: StatusCode=200; $iResult = 0; $sResponseText={"value":true}...
_WD_ElementAction: {"value":true}...
__WD_Get: URL=HTTP://127.0.0.1:9515/session/f7c8d4bea5f711c49040338825cc8c75/element/e83ca5de-de7d-4a0d-80fb-a96b827a8868/enabled
__WD_Get: StatusCode=200; $iResult = 0; $sResponseText={"value":true}...
_WD_ElementAction: {"value":true}...
_WD_WaitElement ==> Success
__WD_Post: URL=HTTP://127.0.0.1:9515/session/f7c8d4bea5f711c49040338825cc8c75/element/e83ca5de-de7d-4a0d-80fb-a96b827a8868/clear; $sData={"id":"e83ca5de-de7d-4a0d-80fb-a96b827a8868"}
__WD_Post: StatusCode=200; ResponseText={"value":null}...
_WD_ElementAction: {"value":null}...
__WD_Post: URL=HTTP://127.0.0.1:9515/session/f7c8d4bea5f711c49040338825cc8c75/element/e83ca5de-de7d-4a0d-80fb-a96b827a8868/value; $sData={"id":"e83ca5de-de7d-4a0d-80fb-a96b827a8868", "text":"00050565"}
__WD_Post: StatusCode=200; ResponseText={"value":null}...
_WD_ElementAction: {"value":null}...
_WD_SetElementValue ==> Success
__WD_Post: URL=HTTP://127.0.0.1:9515/session/f7c8d4bea5f711c49040338825cc8c75/element; $sData={"using":"xpath","value":"//*[@id='cyfraKontrolna']"}
__WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"242496b6-212c-4fe6-9fb2-ef8dccae156f"}}...
_WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"242496b6-212c-4fe6-9fb2-ef8dccae156f"}}
__WD_Get: URL=HTTP://127.0.0.1:9515/session/f7c8d4bea5f711c49040338825cc8c75/element/242496b6-212c-4fe6-9fb2-ef8dccae156f/displayed
__WD_Get: StatusCode=200; $iResult = 0; $sResponseText={"value":true}...
_WD_ElementAction: {"value":true}...
__WD_Get: URL=HTTP://127.0.0.1:9515/session/f7c8d4bea5f711c49040338825cc8c75/element/242496b6-212c-4fe6-9fb2-ef8dccae156f/enabled
__WD_Get: StatusCode=200; $iResult = 0; $sResponseText={"value":true}...
_WD_ElementAction: {"value":true}...
_WD_WaitElement ==> Success
__WD_Post: URL=HTTP://127.0.0.1:9515/session/f7c8d4bea5f711c49040338825cc8c75/element/242496b6-212c-4fe6-9fb2-ef8dccae156f/clear; $sData={"id":"242496b6-212c-4fe6-9fb2-ef8dccae156f"}
__WD_Post: StatusCode=200; ResponseText={"value":null}...
_WD_ElementAction: {"value":null}...
__WD_Post: URL=HTTP://127.0.0.1:9515/session/f7c8d4bea5f711c49040338825cc8c75/element/242496b6-212c-4fe6-9fb2-ef8dccae156f/value; $sData={"id":"242496b6-212c-4fe6-9fb2-ef8dccae156f", "text":"0"}
__WD_Post: StatusCode=200; ResponseText={"value":null}...
_WD_ElementAction: {"value":null}...
_WD_SetElementValue ==> Success
__WD_Post: URL=HTTP://127.0.0.1:9515/session/f7c8d4bea5f711c49040338825cc8c75/element; $sData={"using":"css selector","value":".error-content .visible"}
__WD_Post: StatusCode=404; ResponseText={"value":{"error":"no such element","message":"no such element: Unable to locate element: {\"method\...
__WD_Post ==> No match: {"value":{"error":"no such element","message":"no such element: Unable to locate element: {\"method\":\"css selector\",\"selector\":\".error-content .visible\"}\n  (Session info: headless chrome=96.0.4664.110)","stacktrace":"Backtrace:\n\tOrdinal0 [0x01096903+2517251]\n\tOrdinal0 [0x0102F8E1+2095329]\n\tOrdinal0 [0x00F32848+1058888]\n\tOrdinal0 [0x00F5D448+1233992]\n\tOrdinal0 [0x00F5D63B+1234491]\n\tOrdinal0 [0x00F87812+1406994]\n\tOrdinal0 [0x00F7650A+1336586]\n\tOrdinal0 [0x00F85BBF+1399743]\n\tOrdinal0 [0x00F7639B+1336219]\n\tOrdinal0 [0x00F527A7+1189799]\n\tOrdinal0 [0x00F53609+1193481]\n\tGetHandleVerifier [0x01225904+1577972]\n\tGetHandleVerifier [0x012D0B97+2279047]\n\tGetHandleVerifier [0x01126D09+534521]\n\tGetHandleVerifier [0x01125DB9+530601]\n\tOrdinal0 [0x01034FF9+2117625]\n\tOrdinal0 [0x010398A8+2136232]\n\tOrdinal0 [0x010399E2+2136546]\n\tOrdinal0 [0x01043541+2176321]\n\tBaseThreadInitThunk [0x75B3FA29+25]\n\tRtlGetAppContainerNamedObjectPath [0x77037A9E+286]\n\tRtlGetAppContainerNamedObjectPath [0x77037A6E+238]\n"}}
_WD_FindElement: {"value":{"error":"no such element","message":"no such element: Unable to locate element: {\"method\":\"css selector\",\"selector\":\".error-content .visible\"}\n  (Session info: headless chrome=96.0.4664.110)","stacktrace":"Backtrace:\n\tOrdinal0 [0x01096903+2517251]\n\tOrdinal0 [0x0102F8E1+2095329]\n\tOrdinal0 [0x00F32848+1058888]\n\tOrdinal0 [0x00F5D448+1233992]\n\tOrdinal0 [0x00F5D63B+1234491]\n\tOrdinal0 [0x00F87812+1406994]\n\tOrdinal0 [0x00F7650A+1336586]\n\tOrdinal0 [0x00F85BBF+1399743]\n\tOrdinal0 [0x00F7639B+1336219]\n\tOrdinal0 [0x00F527A7+1189799]\n\tOrdinal0 [0x00F53609+1193481]\n\tGetHandleVerifier [0x01225904+1577972]\n\tGetHandleVerifier [0x012D0B97+2279047]\n\tGetHandleVerifier [0x01126D09+534521]\n\tGetHandleVerifier [0x01125DB9+530601]\n\tOrdinal0 [0x01034FF9+2117625]\n\tOrdinal0 [0x010398A8+2136232]\n\tOrdinal0 [0x010399E2+2136546]\n\tOrdinal0 [0x01043541+2176321]\n\tBaseThreadInitThunk [0x75B3FA29+25]\n\tRtlGetAppContainerNamedObjectPath [0x77037A9E+286]\n\tRtlGetAppContainerNamedObjectPath [0x77037A6E+238]\n"}}
_WD_FindElement ==> No match: HTTP status = 404
__WD_Post: URL=HTTP://127.0.0.1:9515/session/f7c8d4bea5f711c49040338825cc8c75/element; $sData={"using":"xpath","value":"//*[@id='wyszukaj']"}
__WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"259e6b71-6b8f-44fe-9d08-2a050419b844"}}...
_WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"259e6b71-6b8f-44fe-9d08-2a050419b844"}}
__WD_Get: URL=HTTP://127.0.0.1:9515/session/f7c8d4bea5f711c49040338825cc8c75/element/259e6b71-6b8f-44fe-9d08-2a050419b844/displayed
__WD_Get: StatusCode=200; $iResult = 0; $sResponseText={"value":true}...
_WD_ElementAction: {"value":true}...
__WD_Get: URL=HTTP://127.0.0.1:9515/session/f7c8d4bea5f711c49040338825cc8c75/element/259e6b71-6b8f-44fe-9d08-2a050419b844/enabled
__WD_Get: StatusCode=200; $iResult = 0; $sResponseText={"value":true}...
_WD_ElementAction: {"value":true}...
_WD_WaitElement ==> Success
__WD_Post: URL=HTTP://127.0.0.1:9515/session/f7c8d4bea5f711c49040338825cc8c75/element/259e6b71-6b8f-44fe-9d08-2a050419b844/click; $sData={"id":"259e6b71-6b8f-44fe-9d08-2a050419b844"}
__WD_Post: StatusCode=0; ResponseText=WinHTTP request timed out before Webdriver...
__WD_Post ==> Send / Recv error: WinHTTP request timed out before Webdriver
_WD_ElementAction: WinHTTP request timed out before Webdriver...
_WD_ElementAction ==> Send / Recv error: WinHTTP request timed out before Webdriver
__WD_Post: URL=HTTP://127.0.0.1:9515/session/f7c8d4bea5f711c49040338825cc8c75/element; $sData={"using":"xpath","value":"//*[@id='przyciskWydrukZwykly']"}
__WD_Post: StatusCode=0; ResponseText=WinHTTP request timed out before Webdriver...
__WD_Post ==> Send / Recv error: WinHTTP request timed out before Webdriver
_WD_FindElement: WinHTTP request timed out before Webdriver
_WD_FindElement ==> Send / Recv error: HTTP status = 0
_WD_WaitElement ==> Timeout
! 381 - NOT COMPILED Intercept_MessageBoxW WATCH POINT
 

Expand  

and at the same time I get:

 

image.png

 

Alll this following process they are suspended browser processes that were being automated during test execution.
Chromedriver.exe is closed but chrome.exe is still sitting in the background.

image.png.0254df64a7d67482848d98d823abd045.png

 

are 

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

The main problem is why Chormedriver not always gives information "invalid argument: user data directory is already in use, please specify a unique value for --user-data-dir argument, or don't use --user-data-dir" ?

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 1/4/2022 at 10:19 PM, mLipok said:

The main problem is why Chormedriver not always gives information "invalid argument: user data directory is already in use, please specify a unique value for --user-data-dir argument, or don't use --user-data-dir" ?

Expand  

1) Have you tried checking ProcessExists() at the beginning of your script (even if it's just for debugging purposes)? You could also use something like ProcExp to try to identify the processes that have those resources in use.

2) It's possible that __WD_CloseDriver needs improvement in how it forcibly shuts down the webdriver

3) Please be mindful that some discussions are outside the scope of this thread and should either go into a separate thread or the one in GH&S. 😉

Posted

Good morning, I would like to know if there is an option to save a page that I have open in pdf, as if I did a CTRL + P, and there appears a print window but instead of giving it print, it is given to save the pdf to this page, I do not know if this is possible to save the active page in pdf? I would appreciate the answer to know if this is possible, at the moment I am making it take a print of an element, but this takes me an image, and I would like to do it in pdf to be able to copy the data it brings.

Posted

This thread is not about getting help.
It is about WD UDF in context of maintaining this UDF releases etc....

Ask here:

 

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

Good morning, I would like to know if there is an option to save a page that I have open in pdf, as if I did a CTRL + P, and there appears a print window but instead of giving it print, it is given to save the pdf to this page, I do not know if this is possible to save the active page in pdf? I would appreciate the answer to know if this is possible, at the moment I am making it take a print of an element, but this takes me an image, and I would like to do it in pdf to be able to copy the data it brings.

Posted (edited)
  On 1/5/2022 at 6:53 PM, ElPandaRojo1 said:

Good morning, I would like to know if there is an option to save a page that I have open in pdf, as if I did a CTRL + P, and there appears a print window but instead of giving it print, it is given to save the pdf to this page, I do not know if this is possible to save the active page in pdf? I would appreciate the answer to know if this is possible, at the moment I am making it take a print of an element, but this takes me an image, and I would like to do it in pdf to be able to copy the data it brings.

Expand  

https://www.py4u.net/discuss/17921

 

Answer #3:

In My case it worked without any code modification,Just need to disabled the Chrome pdf viewer

Here are the steps to disable it

  1. Go into Chrome Settings
  2. Scroll to the bottom click on Advanced
  3. Under Privacy And Security - Click on "Site Settings"
  4. Scroll to PDF Documents
  5. Enable "Download PDF files instead of automatically opening them in Chrome"

image.png.da46685db2bd3a56a4021b7a9e610f16.png

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)

https://www.edureka.co/community/64462/how-automatically-download-with-selenium-webdriver-python

download_dir = "C:\\Temp\\Dowmload"  # for linux/*nix, download_dir="/usr/Public"
options = webdriver.ChromeOptions()

profile = {"plugins.plugins_list": [{"enabled": False, "name": "Chrome PDF Viewer"}], # Disable Chrome's PDF Viewer
               "download.default_directory": download_dir , "download.extensions_to_open": "applications/pdf"}
options.add_experimental_option("prefs", profile)
driver = webdriver.Chrome('//Server/Apps/chrome_driver/chromedriver.exe', chrome_options=options)  # Optional argument, if not specified will search path.

It would be quite possible to do the same with WD UDF in AutoIt.
This is kind of capabilities to set in the capabilities string.

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)

Dear @DAN:

i have a question ;how to attatch  an exist   chrome  instance  window by WD_attatch?

Edited by andyking
Posted
  On 1/3/2022 at 2:36 PM, TheDcoder said:

You can try the Page.printToPDF CDP command, i

Expand  

Could you provide example ?

 

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 1/6/2022 at 8:37 AM, andyking said:

i have a question ;how to attatch  an exist   chrome  instance  window by WD_attatch?

Expand  

Was this Chrome instance launched via webdriver? What have you tried?

  On 1/6/2022 at 9:17 AM, andyking said:

How to disable UDF version check,i can not connect to the internet,so it just put me the error message:_WD_IsLatestRelease: General Error

Expand  

Put the following line in your script before the call to _WD_Startup --

$_WD_DEBUG = $_WD_DEBUG_Error ; You could also use $_WD_DEBUG_None

You can set the value back to $_WD_DEBUG_Info following the call to _WD_Startup if you desire.

P.S. Be sure to check out the FAQ (link in my sig) and also try the forum search feature, which can help you find answers from prior discussions

Posted
  On 1/6/2022 at 12:58 PM, mLipok said:

Could you provide example ?

Expand  

It shouldn't be hard to do, call the ExecuteCDPCommand function (it might have been renamed) with the name of the command and a JSON object with desired parameters (refer to the documentation of the command for valid parameters).

Let me know if you still need an example for this command.

EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time)

DcodingTheWeb Forum - Follow for updates and Join for discussion

Posted
  On 1/7/2022 at 3:18 AM, Danp2 said:

This is possible, but only under certain circumstances. See my prior post here.

Expand  
#include "wd_core.au3"

Local $sDesiredCapabilities, $sSession

ShellExecute("chrome.exe", "--remote-debugging-port=9222")

SetupChrome()
_WD_Startup()

$sSession = _WD_CreateSession($sDesiredCapabilities)
_WD_Navigate($sSession, "http://yahoo.com")

Func SetupChrome()
_WD_Option('Driver', 'chromedriver.exe')
_WD_Option('Port', 9515)
_WD_Option('DriverParams', '--verbose --log-path="' & @ScriptDir & '\chrome.log"')

$sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"debuggerAddress": "localhost:9222"}}}}'
EndFunc

Thank u @Danp2,

I see your program,see the chrome instance was launched by your code:ShellExecute("chrome.exe", "--remote-debugging-port=9222")

i want attach a exsit instance not launched  by any code,

just like  somebody used you computer to launched a chrome instance

 

Posted

Hi.  I have several scripts that control Chrome web browsers via XPATH, but for some reason I cannot get this particular one to work.  The "SetupChrome" code is copied from the DEMO code.

CODE:

; Set debug level
    $_WD_DEBUG = $_WD_DEBUG_Info

    ; Execute browser setup routine for user's browser selection
    Local $sDesiredCapabilities = Call(SetupChrome)

    _WD_Startup()
    If @error <> $_WD_ERROR_Success Then Return

    $sSession = _WD_CreateSession($sDesiredCapabilities)
   _WD_Navigate($sSession, "https://iapps.courts.state.ny.us/chrs/SignIn")
   _WD_LoadWait($sSession, 2000)


; Enter UserName
      $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "/html/body/div/div[3]/div[1]/div[2]/form/div[4]/fieldset/input[1]")
      If @error = $_WD_ERROR_Success Then
         _WD_ElementAction($sSession, $sElement, 'value', "jason")
      EndIf

 

ERROR IN THE CONSOLE:

_WD_Post: URL=HTTP://127.0.0.1:9515/session/6ecec49691b42a35040ba77c8cb359ea/element; $sData={"using":"xpath","value":"/html/body/div/div[3]/div[1]/div[2]/form/div[4]/fieldset/input[1]"}
__WD_Post: StatusCode=404; ResponseText={"value":{"error":"no such element","message":"no such element: Unable to locate element: {\"method\...

I have double checked the XPATH to the username field.  I also cannot get a value inserted into the password field at this XPATH:

/html/body/div/div[3]/div[1]/div[2]/form/div[4]/fieldset/input[2]

Any help on this would be appreciated.  Not sure if this site is somehow blocking me running a script.

 

 

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

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