Jump to content

Firefox Issue "Browser is under remote control" when using AutoIt with WebDriver


Recommended Posts

Hello forum,

I have the problem that I can not use Firefox in combination with WebDriver when using AutoIt on some websites. Of course it does not work with the very website I need it to work with.

As soon as I want to open the desired website, I get the little robot icon which tells me that the "browser is under remote control" and the website stays blank.
I CAN open the website (www.ebay-kleinanzeigen.de) but I get blocked when I want to go to my account, to be precise.

I am using AutoIt 3.3.14.5 I have checked my FireFox version. It is up to date. Also the special browser drivers like gecko etrc. are up to date too and everything works fine with the WebDriver demo.

It seems that another user also had the same problem, but the thread has already been closed and the users solution (setting security lower did not work for me).
I mean I can only choose between "standard", "strict" and "customized". On "customized I unchecked everything but it still would not change anything.

I also have checked Google Chrome and MS Edge. Same result.

I tried swiching profiles (only with FireFox). Same result.

I tried to acess a previously opened FireFox session where I manually logged in by using this code snippet:

_WD_Option('Driver', 'C:\Path\to\the\executable\geckodriver.exe')
_WD_Option('DriverParams', '--log trace --connect-existing  --marionette-port 2828')
_WD_Option('Port', 4444)

Obviously I adjusted the path of the geckodriver.exe but it did not work at all on my computer.

So far my code is really basically nothing but I can not even start to code. I myself am not a real coder and I know only the very basics like loops, conditions and variables.

----------------------------------------

; Script Start

#include <Array.au3>
#include <AutoItConstants.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <File.au3>
#include <GuiComboBoxEx.au3>
#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>
#include <StringConstants.au3>
#include <StaticConstants.au3>
#include "wd_core.au3"
#include "wd_helper.au3"
#include <WindowsConstants.au3>

Local $sDesiredCapabilities, $sSession, $sElement

SetupGecko()

$_WD_DEBUG = $_WD_DEBUG_None

_WD_Startup()

    $sSession = _WD_CreateSession($sDesiredCapabilities)
    _WD_Navigate($sSession, "https://www.ebay-kleinanzeigen.de/m-meine-anzeigen.html?sort=CREATION_DATE_ASC&keyword=winter")

Exit

Func SetupGecko()
    _WD_Option('Driver', 'geckodriver.exe')
    _WD_Option('DriverParams', '--log trace  --marionette-port 2828')
    _WD_Option('Port', 4444)

    $sDesiredCapabilities = '{"capabilities":{"alwaysMatch": {"moz:firefoxOptions": {"args": ["-profile", "' & "C:/Users/myaccount/AppData/Roaming/Mozilla/Firefox/Profiles/0123456.default-release" & '"],"log": {"level": "trace"}}}}}'

EndFunc   ;==>SetupGecko

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": {"w3c": true, "excludeSwitches": [ "enable-automation"]}}}}'
EndFunc   ;==>SetupChrome

Func SetupEdge()
    _WD_Option('Driver', 'msedgedriver.exe')
    _WD_Option('Port', 9515)
    _WD_Option('DriverParams', '--verbose --log-path="' & @ScriptDir & '\msedge.log"')

    $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"ms:edgeOptions": {"binary": "' & StringReplace(@ProgramFilesDir, "\", "/") & '/Microsoft/Edge/Application/msedge.exe", "excludeSwitches": [ "enable-automation"], "useAutomationExtension": false}}}}'
EndFunc   ;==>SetupEdge

--------------------------------------

I left the three setup functions in, because I do not care what browser I use as long as I can start coding.

Also, please understand that I am not trying to be lazy here. I do not want someone to code for me. Maybe the problem is very basic, but I just do not know how to eliminate that restriction.

Is it something I need to uncheck in the browser settings or is it more complicated? If you need more information, I will be happy to provide those.

If somebody has an idea or a solution, I would very much appreciate it.

remote.jpg

Edit:
I am not bothered by the robot icon itself. I do not care about it.  If I try to acess my regular ebay account: "https://mesg.ebay.de/mesgweb/ViewMessages/0" it works like a charm despite the notification that the browser is remotely controlled.
My problem is, that the first website does not load for some reason ONLY when the browser is remote controlled.

Edited by Sanja
Posted Code properly
Link to comment
Share on other sites

1 hour ago, Sanja said:

I tried to acess a previously opened FireFox session where I manually logged in by using this code snippet:

How did you launch this prior session?

Hint: This method will only work if you launched Firefox with Marionette enabled.

Quote

$_WD_DEBUG = $_WD_DEBUG_None

I would suggest commenting out this line until you get your script debugged. This will provide the greatest level of console output so that you can more easily identify problems.

P.S. See here for the proper way to post code on the forum

Link to comment
Share on other sites

Hi Dan, thanks for the reply.

13 hours ago, Danp2 said:

P.S. See here for the proper way to post code on the forum

I edited the code now in my post.

13 hours ago, Danp2 said:

How did you launch this prior session?

Hint: This method will only work if you launched Firefox with Marionette enabled.

Well, I started Firefox manually, went to the website and logged it. It always worked fine with AutoIt, when I could use only the Internet Explorer UDFs which i now unfortunately can not any longer. But I immediately get a message that Firefox is already running and I needed to close the first session.

I will not try to fool anybody. I have no idea how to enable Marionette. I added this snipped to my code

_WD_Option('DriverParams', '--log trace  --marionette-port 2828')

like shown in the wiki, but it seems not to be enough.

OK, I will make the console visible again. I just got annoyed that it showed every time. But I understand the purpose of it of course.

Here is what I get. Please do not get mad for me hiding some stuff. I just do not know if it is "important" information or not.

Konsole.thumb.jpg.4b8cc0226855f431a9d130d437308000.jpg
So as far as I understand it just starts everything but then it can not connect and stops after 60 seconds.
The last part in German simply says: "A connection  could not have been established, because the desired computer refused the connection".

A general question:
Is it possible that the website itself somehow checks if the browser is remotely controlled and then stays blank.
I wonder, since other websites even when trying to log in into my account (e.g. ebay) load without problems. And my code is really no code at all. Just the beginning.

Link to comment
Share on other sites

You can hide the console window with _WD_ConsoleVisible. I'm more interested in seeing the results written to the Scite output panel. In the future, please copy / paste the relevant text instead of posting a picture.

I've previously described how to properly launch FireFox manually. Here's one instance, which you could have used the forum's search feature to locate --

Yes, it's possible that the website is detecting that the browser is being controlled. However, we don't yet know enough to conclude that is the situation here.

Link to comment
Share on other sites

 

21 hours ago, Danp2 said:

In the future, please copy / paste the relevant text instead of posting a picture.

 Got it.

20 hours ago, Danp2 said:

I've previously described how to properly launch FireFox manually. Here's one instance, which you could have used the forum's search feature to locate --

Yes I am aware of the search feature. I used it to find the closed thread which I mentioned in my first post. However I did not know about marionette until a few days so I did not search for stuff that I did not know existed.

I tried to launch firefox manually with marionette enabled by acessing the windows command line ("Win" + "R") and running the "firefox.exe -marionette" file.
The Firefox window with the "robot" icon that indicats remote control opend up. I then tried to log in to the desired website https://www.ebay-kleinanzeigen.de/m-einloggen.html?targetUrl=/ (It is a local version of ebay in Germany, in case anybody wonders...)
Here is the important part: Even without the script running the website does not load up, when I launch firefox with marionette enabled. So far only that website does that. My account on regular ebay or my account on DPD (shipping company) works fine.  So I would assume the probleme here.

I then continued to start the script and I got no error message. Instead the existing tab (firefox marionette) was used to navigate to the previously mentioned website.
But I got a blank page again.

Here is what the console displayed:

xxxxxxxx   geckodriver     INFO    Listening on 127.0.0.1:4444
xxxxxxxx   webdriver::server       DEBUG   -> POST /session {"capabilities":{"alwaysMatch": {"moz:firefoxOptions": {"args": ["-profile", "C:/Users/alexs/AppData/Roaming/Mozilla/Firefox/Profiles/xxxxxxx.default-release"],"log": {"level": "trace"}}}}}
xxxxxxxx   geckodriver::marionette DEBUG   Waiting 60s to connect to browser on xxxxxxxxx.
xxxxxxxx   geckodriver::marionette DEBUG   Connection to Marionette established on xxxxxxxx.
xxxxxxxx   webdriver::server       DEBUG   <- 200 OK {"value":{"sessionId":"e9ec6db3-8b5c-456a-bb0e-e873c408c335","capabilities":{"acceptInsecureCerts":false,"browserName":"firefox","browserVersion":"89.0","moz:accessibilityChecks":false,"moz:buildID":"xxxxxxxx","moz:geckodriverVersion":"0.29.1","moz:headless":false,"moz:processID":2940,"moz:profile":"C:\\Users\\alexs\\AppData\\Roaming\\Mozilla\\Firefox\\Profiles\\bmot810b.default-release","moz:shutdownTimeout":60000,"moz:useNonSpecCompliantPointerOrigin":false,"moz:webdriverClick":true,"pageLoadStrategy":"normal","platformName":"windows","platformVersion":"10.0","setWindowRect":true,"strictFileInteractability":false,"timeouts":{"implicit":0,"pageLoad":300000,"script":30000},"unhandledPromptBehavior":"dismiss and notify"}}}
xxxxxxxx   webdriver::server       DEBUG   -> POST /session/e9ec6db3-8b5c-456a-bb0e-e873c408c335/url {"url":"https://www.ebay-kleinanzeigen.de/m-einloggen.html?targetUrl=/"}
1623752512808   webdriver::server       DEBUG   <- 200 OK {"value":null}

As I said I do not know if the information on the colsole is "important" in terms of safety. Is it necessary to hide the information (like I did)?
I am a little nervous posting that stuff but I do not want to make things more complicated than necessary. 
If it is not necessary I can post the message again.

Link to comment
Share on other sites

As I stated earlier, I'm more interested in seeing the complete results written to the Scite output panel. You can post them using the same method you use to post code to the forum. It's fine to obscure any details that you desire to keep private. In reviewing the above, the changes you made probably weren't necessary. FYI, you missed the user name. 😃

FWIW, I tried to replicate your scenario, but the login page displays correctly and I was able to manually login without any apparent issues.

 

Link to comment
Share on other sites

@Danp2
Sorry, I am not familiar with the output panel. I know where it is and what it can do, but I never used it.
I looked around a little and it seems that I can use ConsoleWrite() to post to the output panel. However I am missing the little "Play" Button in the toolbar like in the videos.

I also do no know what exactly you would like to see, since I am not doing anything in my code yet.
Is there another function which posts something like a log entry? Or am I misunderstanding you?

 

19 hours ago, Danp2 said:

FWIW, I tried to replicate your scenario, but the login page displays correctly and I was able to manually login without any apparent issues.

I have no idea why it works on your machine. I also tried another laptop. Both lenovo 64x win10. It did not work either.

You did exactly this:

"launch firefox by accessing the windows command line ("Win" + "R") and running the "firefox.exe -marionette" file.
Then you navigated to: https://www.ebay-kleinanzeigen.de/m-einloggen.html?targetUrl=/
And you actually saw stuff like the login button etc. despite the notification about being remotely controlled?

@Confuzzled
Ebay (like www.ebay.de) works just fine. Even when I acsess the login page it shows me everything an I could proceed with my script.
The blank page only occurs on www.ebay-kleinanzeigen.de. I can access the main page without problems. However as soon as I want to access the login page https://www.ebay-kleinanzeigen.de/m-einloggen.html?targetUrl=/ Firefox will do nothing else and I only see a blank page.
Btw it is the same with Chrome and MS Edge.

Link to comment
Share on other sites

The most probable situation is that eBay is detecting the Navigator.webdriver property:

Quote

The webdriver read-only property of the navigator interface indicates whether the user agent is controlled by automation.

It defines a standard way for co-operating user agents to inform the document that it is controlled by WebDriver, for example, so that alternate code paths can be triggered during automation.

The navigator.webdriver property is true when in:

Chrome
The --enable-automation or the --headless flag or the --remote-debugging-port is used.
Firefox
The marionette.enabled preference or --marionette flag is passed.

It is possible to mask this with some hacks though, here is the JavaScript snippet I used a while ago to mask that in Chrome:

Object.defineProperty(Navigator.prototype, "webdriver", {get: Function.prototype.bind()})

You can use this code by injecting it into every page on start like so:

; Inject Navigator Shim
Local $sNavShim = 'Object.defineProperty(Navigator.prototype, "webdriver", {get: Function.prototype.bind()})'
Local $oParams = Json_ObjCreate()
Json_ObjPut($oParams, 'source', $sNavShim)
_WD_ExecuteCdpCommand($g_sSession, 'Page.addScriptToEvaluateOnNewDocument', $oParams)

But this uses Chrome's non-standard CDP (Chrome DevTools Protocol) protocol (redundant, heh), so obviously it works only in Chrome.

Firefox's equivalent is the Marionette protocol, but I am not familiar with it, so someone else would have to help you with that.

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

Link to comment
Share on other sites

@TheDcoder

I will try that with Chrome and post my results a little bit later.
Although I would prefer to continue with FireFox since I am using it anyway, I am at the point where I really do not care anymore.

If it gets me started and I can actually start coding, it works for me 👍

Link to comment
Share on other sites

@TheDcoderNice Chrome solution. It would be great if we could come up with a UDF that works on all browsers. I'll have to look into how to use addScriptToEvaluateOnNewDocument with webdriver. FWIW, this is the Javascript that I had previously found that appears to yield a similar results --

Object.defineProperty(navigator, 'webdriver', {get: () => undefined})

 

Link to comment
Share on other sites

@SanjaThe Webdriver UDF will output debugging information to the Scite output panel as long as you don't add this line to your code --

$_WD_DEBUG = $_WD_DEBUG_None

If you run wd_demo, you should see output line this --

>"C:\Program Files (x86)\AutoIt3\SciTE\..\AutoIt3.exe" "C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrorStdOut /in "C:\Users\Dan\Dropbox\webdriver\wd_demo.au3" /UserParams    
+>05:49:22 Starting AutoIt3Wrapper (21.316.1639.1) from:SciTE.exe (4.4.6.0)  Keyboard:00000409  OS:WIN_10/2009  CPU:X64 OS:X64  Environment(Language:0409)  CodePage:0  utf8.auto.check:4
+>         SciTEDir => C:\Program Files (x86)\AutoIt3\SciTE   UserDir => C:\Users\Dan\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper   SCITE_USERHOME => C:\Users\Dan\AppData\Local\AutoIt v3\SciTE 
>Running AU3Check (3.3.14.5)  from:C:\Program Files (x86)\AutoIt3  input:C:\Users\Dan\Dropbox\webdriver\wd_demo.au3
+>05:49:23 AU3Check ended.rc:0
>Running:(3.3.14.5):C:\Program Files (x86)\AutoIt3\autoit3_x64.exe "C:\Users\Dan\Dropbox\webdriver\wd_demo.au3"    
+>Setting Hotkeys...--> Press Ctrl+Alt+Break to Restart or Ctrl+BREAK to Stop.
_WD_IsLatestRelease: True
_WD_IsLatestRelease ==> Success
_WD_Startup: OS:    WIN_10 WIN32_NT 19043 
_WD_Startup: AutoIt:    3.3.14.5
_WD_Startup: WD.au3:    0.4.0.4 (Up to date)
_WD_Startup: WinHTTP:   1.6.4.2
_WD_Startup: Driver:    geckodriver.exe
_WD_Startup: Params:    --log trace
_WD_Startup: Port:  4444
__WD_Post: URL=HTTP://127.0.0.1:4444/session; $sData={"capabilities": {"alwaysMatch": {"browserName": "firefox", "acceptInsecureCerts":true}}}
__WD_Post: StatusCode=200; ResponseText={"value":{"sessionId":"4d9155d2-5f03-47c3-99ff-b088795368c8","capabilities":{"acceptInsecureCerts":t...
_WD_CreateSession: {"value":{"sessionId":"4d9155d2-5f03-47c3-99ff-b088795368c8","capabilities":{"acceptInsecureCerts":true,"browserName":"firefox","browserVersion":"89.0","moz:accessibilityChecks":false,"moz:buildID":"20210527174632","moz:geckodriverVersion":"0.29.0","moz:headless":false,"moz:processID":24772,"moz:profile":"C:\\Users\\Dan\\AppData\\Local\\Temp\\rust_mozprofileX0vamj","moz:shutdownTimeout":60000,"moz:useNonSpecCompliantPointerOrigin":false,"moz:webdriverClick":true,"pageLoadStrategy":"normal","platformName":"windows","platformVersion":"10.0","setWindowRect":true,"strictFileInteractability":false,"timeouts":{"implicit":0,"pageLoad":300000,"script":30000},"unhandledPromptBehavior":"dismiss and notify"}}}
Bypass: DemoTimeouts
+Running: DemoNavigation
__WD_Post: URL=HTTP://127.0.0.1:4444/session/4d9155d2-5f03-47c3-99ff-b088795368c8/url; $sData={"url":"http://google.com"}
__WD_Post: StatusCode=200; ResponseText={"value":null}...
_WD_Navigate: {"value":null}
__WD_Get: URL=HTTP://127.0.0.1:4444/session/4d9155d2-5f03-47c3-99ff-b088795368c8/window
__WD_Get: StatusCode=200; $iResult = 0; $sResponseText={"value":"17"}...
_WD_Window: {"value":"17"}...
__WD_Post: URL=HTTP://127.0.0.1:4444/session/4d9155d2-5f03-47c3-99ff-b088795368c8/window/new; $sData={"type":"tab"}
__WD_Post: StatusCode=200; ResponseText={"value":{"handle":"38","type":"tab"}}...
_WD_Window: {"value":{"handle":"38","type":"tab"}}...
__WD_Post: URL=HTTP://127.0.0.1:4444/session/4d9155d2-5f03-47c3-99ff-b088795368c8/window; $sData={"handle":"38"}
__WD_Post: StatusCode=200; ResponseText={"value":null}...
_WD_Window: {"value":null}...
__WD_Post: URL=HTTP://127.0.0.1:4444/session/4d9155d2-5f03-47c3-99ff-b088795368c8/url; $sData={"url":"http://yahoo.com"}
__WD_Post: StatusCode=200; ResponseText={"value":null}...
_WD_Navigate: {"value":null}
__WD_Get: URL=HTTP://127.0.0.1:4444/session/4d9155d2-5f03-47c3-99ff-b088795368c8/window
__WD_Get: StatusCode=200; $iResult = 0; $sResponseText={"value":"38"}...
_WD_Window: {"value":"38"}...
__WD_Get: URL=HTTP://127.0.0.1:4444/session/4d9155d2-5f03-47c3-99ff-b088795368c8/window/handles
__WD_Get: StatusCode=200; $iResult = 0; $sResponseText={"value":["17","38"]}...
_WD_Window: {"value":["17","38"]}...
__WD_Post: URL=HTTP://127.0.0.1:4444/session/4d9155d2-5f03-47c3-99ff-b088795368c8/execute/sync; $sData={"script":"window.open(arguments[0], '', arguments[1])", "args":["http://bing.com","width=200,height=200"]}
__WD_Post: StatusCode=200; ResponseText={"value":null}...
_WD_ExecuteScript: {"value":null}...
__WD_Get: URL=HTTP://127.0.0.1:4444/session/4d9155d2-5f03-47c3-99ff-b088795368c8/window/handles
__WD_Get: StatusCode=200; $iResult = 0; $sResponseText={"value":["17","38","6442450951"]}...
_WD_Window: {"value":["17","38","6442450951"]}...
__WD_Post: URL=HTTP://127.0.0.1:4444/session/4d9155d2-5f03-47c3-99ff-b088795368c8/window; $sData={"handle":"6442450951"}
__WD_Post: StatusCode=200; ResponseText={"value":null}...
_WD_Window: {"value":null}...
__WD_Get: URL=HTTP://127.0.0.1:4444/session/4d9155d2-5f03-47c3-99ff-b088795368c8/url
__WD_Get: StatusCode=200; $iResult = 0; $sResponseText={"value":"about:blank"}...
_WD_Action: {"value":"about:blank"}
URL=about:blank
__WD_Get: URL=HTTP://127.0.0.1:4444/session/4d9155d2-5f03-47c3-99ff-b088795368c8/window/handles
__WD_Get: StatusCode=200; $iResult = 0; $sResponseText={"value":["17","38","6442450951"]}...
_WD_Window: {"value":["17","38","6442450951"]}...
__WD_Get: URL=HTTP://127.0.0.1:4444/session/4d9155d2-5f03-47c3-99ff-b088795368c8/window
__WD_Get: StatusCode=200; $iResult = 0; $sResponseText={"value":"6442450951"}...
_WD_Window: {"value":"6442450951"}...
__WD_Post: URL=HTTP://127.0.0.1:4444/session/4d9155d2-5f03-47c3-99ff-b088795368c8/window; $sData={"handle":"17"}
__WD_Post: StatusCode=200; ResponseText={"value":null}...
_WD_Window: {"value":null}...
__WD_Get: URL=HTTP://127.0.0.1:4444/session/4d9155d2-5f03-47c3-99ff-b088795368c8/url
__WD_Get: StatusCode=200; $iResult = 0; $sResponseText={"value":"https://www.google.com/?gws_rd=ssl"}...
_WD_Action: {"value":"https://www.google.com/?gws_rd=ssl"}
__WD_Get: URL=HTTP://127.0.0.1:4444/session/4d9155d2-5f03-47c3-99ff-b088795368c8/url
__WD_Get: StatusCode=200; $iResult = 0; $sResponseText={"value":"https://www.google.com/?gws_rd=ssl"}...
_WD_Action: {"value":"https://www.google.com/?gws_rd=ssl"}
URL=https://www.google.com/?gws_rd=ssl
__WD_Get: URL=HTTP://127.0.0.1:4444/session/4d9155d2-5f03-47c3-99ff-b088795368c8/window/handles
__WD_Get: StatusCode=200; $iResult = 0; $sResponseText={"value":["17","38","6442450951"]}...
_WD_Window: {"value":["17","38","6442450951"]}...
__WD_Get: URL=HTTP://127.0.0.1:4444/session/4d9155d2-5f03-47c3-99ff-b088795368c8/window
__WD_Get: StatusCode=200; $iResult = 0; $sResponseText={"value":"17"}...
_WD_Window: {"value":"17"}...
__WD_Post: URL=HTTP://127.0.0.1:4444/session/4d9155d2-5f03-47c3-99ff-b088795368c8/window; $sData={"handle":"17"}
__WD_Post: StatusCode=200; ResponseText={"value":null}...
_WD_Window: {"value":null}...
__WD_Get: URL=HTTP://127.0.0.1:4444/session/4d9155d2-5f03-47c3-99ff-b088795368c8/url
__WD_Get: StatusCode=200; $iResult = 0; $sResponseText={"value":"https://www.google.com/?gws_rd=ssl"}...
_WD_Action: {"value":"https://www.google.com/?gws_rd=ssl"}
__WD_Post: URL=HTTP://127.0.0.1:4444/session/4d9155d2-5f03-47c3-99ff-b088795368c8/window; $sData={"handle":"38"}
__WD_Post: StatusCode=200; ResponseText={"value":null}...
_WD_Window: {"value":null}...
__WD_Get: URL=HTTP://127.0.0.1:4444/session/4d9155d2-5f03-47c3-99ff-b088795368c8/url
__WD_Get: StatusCode=200; $iResult = 0; $sResponseText={"value":"https://www.yahoo.com/"}...
_WD_Action: {"value":"https://www.yahoo.com/"}
__WD_Get: URL=HTTP://127.0.0.1:4444/session/4d9155d2-5f03-47c3-99ff-b088795368c8/url
__WD_Get: StatusCode=200; $iResult = 0; $sResponseText={"value":"https://www.yahoo.com/"}...
_WD_Action: {"value":"https://www.yahoo.com/"}
URL=https://www.yahoo.com/
+Finished: DemoNavigation
Bypass: DemoElements
Bypass: DemoScript
Bypass: DemoCookies
Bypass: DemoAlerts
Bypass: DemoFrames
Bypass: DemoActions
Bypass: DemoDownload
Bypass: DemoWindows
Bypass: DemoUpload
__WD_Delete: URL=HTTP://127.0.0.1:4444/session/4d9155d2-5f03-47c3-99ff-b088795368c8
__WD_Delete: StatusCode=200; ResponseText={"value":null}...
_WD_DeleteSession: {"value":null}
+>05:49:44 AutoIt3.exe ended.rc:0
+>05:49:44 AutoIt3Wrapper Finished.
>Exit code: 0    Time: 23.07

You should get in the habit of reviewing this output when you are troubleshooting your scripts.

Link to comment
Share on other sites

14 hours ago, Danp2 said:

It would be great if we could come up with a UDF that works on all browsers.

Indeed, but considering that everything aside from the usual WebDriver interface is non-standard, it is going to be a hard task catering for every kind of web driver. I don't think geckodriver even gives us an interface to interact with marionette like chromedriver's "execute CDP command" command (redundancy again, lol).

14 hours ago, Danp2 said:

I'll have to look into how to use addScriptToEvaluateOnNewDocument with webdriver.

Does my code not work anymore? It used to work properly with older chrome versions.

14 hours ago, Danp2 said:

FWIW, this is the Javascript that I had previously found that appears to yield a similar results --

The code pretty similar, but the difference is that your code uses an arrow function while mine creates a traditional function (it simply clones the default function prototype, which does nothing and returns undefined).

There are slight differences between a function created by an arrow expression and a normal function, though I am not sure if the former has any issues, it is better to stick with a normal function just to be safe.

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

Link to comment
Share on other sites

8 minutes ago, TheDcoder said:

Does my code not work anymore? It used to work properly with older chrome versions.

I suspect it still works. I wanted to see if there was a way to do something similar in Firefox. I did find these --

https://bugzilla.mozilla.org/show_bug.cgi?id=1597879

https://bugzilla.mozilla.org/show_bug.cgi?id=1601695

Link to comment
Share on other sites

@Danp2 What?! Firefox has it's own remote protocol which is based on Chrome's? 😳

Quote

The Firefox Remote Protocol is a low-level debugging interface based on the CDP protocol. With it, you can inspect the state and control execution of documents running in web content, instrument Gecko in interesting ways, simulate user interaction for automation purposes, and debug JavaScript execution

The good news is that according to the first ticket you mentioned, they have already implemented addScriptToEvaluateOnNewDocument... but since geckodriver doesn't provide a convenient way to interact with it like chromedriver, we would have to use the interface directly.

We could start the driver in both marionette mode and remote debugging mode I think, but we will have to use separate connections for both because of the different interfaces, on top of that, the remote protocol uses WebSockets (has anyone made an UDF yet?) for communication, so the normal WinHTTP won't work.

Basically this will be very different from web driver.

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

Link to comment
Share on other sites

5 minutes ago, Danp2 said:

Yes... we discussed this previously over on Github. 😜

I must have forgotten.

6 minutes ago, Danp2 said:

I have yet to find details on how to access Firefox's CDP, but I'm still looking.

Did you follow the link where I mentioned usage?:
https://firefox-source-docs.mozilla.org/remote/Usage.html

You should try using a WebSocket client and manually sending messages, you can use the same source for documentation on the format for communication.

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

Link to comment
Share on other sites

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...