0

I am trying to automate a booking in process on a travel site using splinter and having trouble clicking on a css element on the page.

This is my code

import splinter
import time

secret_deals_email = {
    'user[email]': 'adf@sad.com'
}

browser = splinter.Browser()
url = 'http://roomer-qa-1.herokuapp.com'
browser.visit(url)
click_FIND_ROOMS = browser.find_by_css('.blue-btn').first.click()
time.sleep(10)
# click_Book_button = browser.find_by_css('.book-button-row.blue-btn').first.click()
browser.fill_form(secret_deals_email)
click_get_secret_deals = browser.find_by_name('button').first.click()
time.sleep(10)
click_book_first_room_list = browser.find_by_css('.book-button-row-link').first.click()
time.sleep(5)
click_book_button_entry = browser.find_by_css('.entry-white-box.entry_box_no_refund').first.click()

The problem is whenever I run it and the code gets to the page where I need to click the sort of purchase I would like. I can't click any of the option on the page.

I keep getting an error of the element not existing no matter what should I do.

http://roomer-qa-1.herokuapp.com/hotels/atlanta-hotels/ramada-plaza-atlanta-downtown-capitol-park.h30129/44389932?rate_plan_id=1&rate_plan_token=6b5aad6e9b357a3d9ff4b31acb73c620&

This is the link to the page that is causing me trouble please help :).

Vaibhav Mule
  • 5,016
  • 4
  • 35
  • 52
gomri15
  • 1
  • 1

1 Answers1

0

You need to whait until the element is present at the website. You can use the is_element_not_present_by_css method with a while loop to do that

while not(is_element_not_present_by_css('.entry-white-box.entry_box_no_refund')):
  time.sleep(50)
Gil Sousa
  • 769
  • 5
  • 12