chromedriver log errors to file

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
robsmith
Newbie
Posts: 17
Joined: Mon Oct 30, 2023 2:12 pm
Location: USA

chromedriver log errors to file

Post by robsmith » Mon Oct 30, 2023 4:32 pm

I searched and reviewed the chromedriver posts first and did not see anything related to this.

Is it possible to log chromedriver errors to file instead of standard error output?

https://chromedriver.chromium.org/logging suggests that some web driver clients support this but not all.

I tried

Code: Select all

Let>CHROMEDRIVER_EXE=C:\ChromeForTesting\chromedriver.exe --verbose --log-path=C:\ChromeForTesting\chromedriver.log
and also tried

Code: Select all

Let>CHROMEDRIVER_OPTIONS=--verbose --log-path=C:\ChromeForTesting\chromedriver.log
but I could not get a chromedriver log file to generate.

Thank you!
Last edited by robsmith on Thu Nov 09, 2023 10:25 pm, edited 1 time in total.

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1376
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: chromedriver log errors to file

Post by Dorian (MJT support) » Tue Oct 31, 2023 2:21 pm

I couldn't write to that folder, but with a little edit and a change of path was able to generate a log file.

Code: Select all

Let>CHROMEDRIVER_OPTIONS=--verbose,--log-file=d:\\chromedriver.log
Also note you need to be running the following version of newer :
Version 15.0.12 02/09/2020
- Added: CHROMEDRIVER_OPTIONS variable to specify chrome startup switches
Yes, we have a Custom Scripting Service. Message me or go here

robsmith
Newbie
Posts: 17
Joined: Mon Oct 30, 2023 2:12 pm
Location: USA

Re: chromedriver log errors to file

Post by robsmith » Thu Nov 09, 2023 10:10 pm

Thank you! I tried this and it does create a chromedriver.log file but it doesn't have much info in it, I think it's not working as expected.

My attempt based on your example:

Code: Select all

KillProcess>chromedriver.exe
KillProcess>chrome.exe
Let>TargetURL=https://www.tide.com
Let>CHROMEDRIVER_EXE=C:\ChromeForTesting\chromedriver.exe
Let>CHROMEDRIVER_PORT=10094
Let>CHROMEDRIVER_OPTIONS=--verbose,--log-file=C:\\ChromeForTesting\\chromedriver.log,--start-maximized --incognito %TargetURL%
Wait>0.1
ChromeStart>ChromeSessionID
ChromeExecute>ChromeSessionID,document.querySelector("#site-header > div.header-search-bar > div > div > div > form > div > input[type=search]").click()
**BREAKPOINT**
If I start chromedriver manually, I can see the full log of what happens in the chromedriver.log (quite different results in the log file than the first example):

Code: Select all

KillProcess>chromedriver.exe
KillProcess>chrome.exe
RunProgram>C:\ChromeForTesting\chromedriver.exe --verbose --log-path=C:\ChromeForTesting\chromedriver.log --port=10094
Let>TargetURL=https://www.tide.com
Let>CHROMEDRIVER_EXE=C:\ChromeForTesting\chromedriver.exe
Let>CHROMEDRIVER_PORT=10094
Let>CHROMEDRIVER_OPTIONS=--start-maximized,--incognito %TargetURL%
Wait>0.1
ChromeStart>ChromeSessionID
ChromeExecute>ChromeSessionID,document.querySelector("#site-header > div.header-search-bar > div > div > div > form > div > input[type=search]").click()
**BREAKPOINT**
For reference, I am using 15.0.21 Sept 2022 build of Macro Scheduler Pro and ChomeForTesting v116 from https://googlechromelabs.github.io/chrome-for-testing/ (I believethe latest version will work the same).

My end goal here is to improve my process for logging that will show me the details if I have entered some invalid javascript statement with ChromeExecute>.

For instance, I attempted to use:

Code: Select all

ChromeExecute>SessionID,document.querySelector("#\\38 4190f63-5c16-4917-a103-e12847b3d1e3").click()
and I find in the tail of the chromedriver.log:

Code: Select all

"Failed to execute 'querySelector' on 'Document': '#\\u00038 4190f63-5c16-4917-a103-e12847b3d1e3' is not a valid selector.
and

Code: Select all

RESPONSE ExecuteScript ERROR invalid element state: Failed to execute 'querySelector' on 'Document': '#8 4190f63-5c16-4917-a103-e12847b3d1e3' is not a valid selector.
(note there is a unicode character in this last log statement between the # and the 8, which doesn't appear to be supported on this page)
Which tells me there are some unsupported characters, I am just not sure what the limits are.

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts