Custom User Agent string not being used in Safari

We have specified user agent strings for Chrome and Safari under Project > Settings > Desired Capabilities > Web UI. When running the scripts on macOS the user agent string viewed in Splunk is not the same string we specified in Katalon.

What was specified in Katalon:
-User-Agent=Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36 DejaClick

What is seen in Splunk:
-User-Agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.5 Safari/605.1.15

Hey Amy @abecker, is it possible for you to provide more detail about your problem, like screenshots or videos of your process/configuration. You can check this post here on how to provide the necessary information for us to help you.

1 Like

We have specified the following User Agent string in Katalon for Safari:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.114 Safari/537.36 DejaClick

We log all activity on our website in Splunk. The activity coming in from my mac when running the Katalon script shows the user agent as:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.5 Safari/605.1.15

@abecker, given that Katalon does not have someone who specializes in Splunk so can you provide documentation and the steps for us to reproduce the situation on Splunk? If you are an Enterprise user, you can submit a ticket and get professional support here.

Also, in your 1st post, you specified -User-Agent=Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36 DejaClick in Katalon Studio, which the OS is Window.

But in your 2nd post, you specified Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.114 Safari/537.36 DejaClick in Katalon Studio, which the OS is macOS.

I was just wondering whether that influences your result?

I did change the user agent string to be Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.114 Safari/537.36 DejaClick in Katalon Project > Settings > Desired Capabilities > Web UI. The user agent string for the activity hitting the web site still does not match what was specified in Katalon.

In your opinion, Katalon should be using the user agent string that I have specified when running on macOS? When using Chrome the user string specified in Katalon matches what we see in the activity hitting the web site (in Splunk).

@abecker, because Katalon never attempts to use user agent string with another website like Splunk so we can’t judge the behavior. Can you show the steps you take on Splunk so we can reproduce your problem and evaluate the behavior on our side?

In Splunk I search for activity from my IP address by using: message.cliIP={my ip address}

I look at the message.UA field in Splunk which shows the user agent string for the browser hitting our web site https://uat.famousfootwear.com

In my case, when I hit https://uat.famousfootwear.com manually from Safari, my user agent captured in Splunk is Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.5 Safari/605.1.15.

When I run a script against https://uat.famousfootwear.com in Katalon Studio executing on Safari, my user agent captured in Splunk is also Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.5 Safari/605.1.15.

I am expecting the user agent to be the value I set in Project > Settings > Desired Capabilities > Web UI, which is Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.114 Safari/537.36 DejaClick.

When the script runs in Katalon I can see in the log viewer the User set preference statement which matches what I have set in Desired Capabilities.

But what is actually being used by the browser when hitting https://uat.famousfootwear.com is not what was speicified in Desired Capabilities.

@abecker, try following this post, and instead of Katalon Project > Settings > Desired Capabilities > Web UI, configure the user agent in Katalon Project > Settings > Desired Capabilities > Custom and see what happen.

I replaced my user agent setting using the instructions on https://forum.katalon.com/t/adding-user-agent/9318/3. My Safari browser, when running from Katalon, is not using the agent provided.

I removed the user agent string that we had originally setup under Desired Capabilities > Web UI > Safari.

I created a new user agent string under Desired Capabilities > Custom. The value I entered was Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.5 Safari/605.1.15 DejaClick

We ran a script using Custom capabilities.

The browser activity hitting our website was still coming from

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.134 Safari/537.36

@abecker, after checking again with Customer Support, we assume this might be Katalon’s problem. If you are an Enterprise user, can you submit a ticket here so we can bring it up to the Product Team about this problem?