Open In App

Sign in Booking.com using Selenium in Python

In this article, we’re going to study a simple how-to log in booking.com by selenium. Selenium is a free tool for automated trying out across exceptional browsers.

Requirement:



Below are the steps:



Below is the implementation:




# import required modules
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
  
# create instance of Chrome webdriver
driver = webdriver.Chrome()
  
# find the element where we have to
# enter the xpath
# fill the  email
driver.find_element_by_xpath('//*[@id="username"]').send_keys('xxxxxx.com')
  
# click on next button
driver.find_element_by_xpath(
    '//*[@id="root"]/div/div[2]/div[1]/div/div/div/div/div/div/form/div[3]/button/span').click()
  
# find the element where we have to
# enter the xpath
# fill the password
driver.find_element_by_xpath('//*[@id="password"]').send_keys('Praxxxxx')
  
# find the element Sign in
# request using xpath
# clicking on that element
driver.find_element_by_xpath(
    '//*[@id="root"]/div/div[2]/div[1]/div/div/div/div/div/div/form/button/span').click()

Output:


Article Tags :