Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

SNOW and Selenium

Tom Daria
Kilo Contributor

Greetings.

We are on the San Diego version of Service Now.

I am an admin on our test site and wish to write Selenium Web UI Smoke Tests against our instance.

However when I view source on any page (ie service request, incident, etc) the DOM is not available and my C# code is failing.
Here is an example.

            //Incidents Opened
            WebElement wei = (WebElement)driver.FindElement(By.LinkText("Incidents Opened")); 
            //The above line of code returns null but in Chrome F12, I do see the DOM.

 

What am I missing?  Or can't I write Selenium tests against my SNOW instance.

 

In Advance,

Thanks

 

Tom

2 REPLIES 2

ArjunBasnet
Tera Guru

Hello Tom,

I am pretty sure that you have already checked this, but throwing some ideas.

If you are opening any record form within ServiceNow Classic UI shell. The record form and list are rendered inside an iframe, identified with gsft_main

 

Regards,

Arjun

quick-111
Tera Contributor

I actually posted a solution to your issue here. Although my solution is in python, I think you'll find that it's helpful. Fundamentally you must gain access to the elements via JavaScript.

https://www.seamlessmigration.com/servicenow-selenium-shadown-doms/