Automatic login to ServiceNow with Selenium Web Driver

◆ Overview

◆ Operating environment

◆ Preparation

ServiceNow instance creation

Python execution environment preparation

Preparing Selenium

◆ Try operating ServiceNow

Launch browser

from selenium import webdriver

#Launch Google Chrome
driver = webdriver.Chrome(executable_path = 'Chrome Driver path')
#Maximize the window
driver.maximize_window()

Access the ServiceNow login page

#Access the ServiceNow login page
driver.get('https://<ServiceNow instance name>.service-now.com/')
driver.implicitly_wait(20)

Get elements of login form

#Get the iframe element that contains the login form
login_iframe = driver.find_element_by_xpath("//*[@id='gsft_main']")
#Move into the specified iframe
driver.switch_to_frame(login_iframe)

#Get elements of user name form&Enter user name
user_name_form = driver.find_element_by_id('user_name')
user_name_form.send_keys("<username>")

#Get password form elements&password input
password_form = driver.find_element_by_id('user_password')
password_form.send_keys("<password>")

#Get login button elements&Click login button
login_button = driver.find_element_by_id('sysverb_login')
login_button.click()

driver.implicitly_wait(20)

#Exit the iframe
driver.switch_to.default_content()

◆ Reference page

Recommended Posts

Automatic login to ServiceNow with Selenium Web Driver
How to automatically install Chrome Driver for Chrome version with Python + Selenium + Chrome
[Python] Warning came out when I raised from Selenium 3 to 4 [Web Driver]
Automat WEB process with Heroku + Selenium + Chrome
Practice web scraping with Python and Selenium
I really wanted to copy with selenium
Automatic posting of web design gary site with python + selenium (1) Environment construction
How to use JDBC driver with Redash
How to convert Web pages to PDF, PNG, JPG with VBA (Excel) (Selenium Basic)
I tried to easily create a fully automatic attendance system with Selenium + Python
Automatic operation of Chrome with Python + Selenium + pandas
Introduction to Tornado (1): Python web framework started with Tornado
How to deal with SessionNotCreatedException when using Selenium
Log in to Yahoo Business with Selenium Python
Automatic version sync of chrome driver binary with chrome
Scraping with selenium
Scraping with selenium ~ 2 ~
Beginning with Selenium
I want to detect unauthorized login to facebook with Jubatus (1)
Just add the driver to the shape key with blender
Automatic follow on Twitter with python and selenium! (RPA)
I was addicted to scraping with Selenium (+ Python) in 2020
I tried a simple RPA for login with selenium
How to switch to smartphone mode with Python + Selenium + Chrome
Deploy a web app created with Streamlit to Heroku
How to operate Firefox with selenium on Windows Memo