Take a Screenshot of a web page and “Click” buttons in a web page

Here we will take a screen shot of the Ocean Viewer page. Since it has a welcome alert that we do not want included in the screenshot we closed the welcome alert before taking the screen shot.

Ocean Viewer Screen Shot


#Import Selenium Webdriver
from selenium import webdriver

#open Fire fox
driver = webdriver.Firefox()

# Resize the window to the desired screen width/height
driver.set_window_size(1300, 800)

#Open URL

# Close welcome screen
#To find element id right click on button and hit select inspect element 
#The name will be in a bubble above the text. 
#In our case the element id is close welcome screen 

#save screenshot

#close window