---
title: "Discussion on \"Create an Automated Web Bot with Selenium in Python\" | Hashnode"
description: "Discussion on \"Create an Automated Web Bot with Selenium in Python\". Motivation\nDue to the pandemic, a lot of activities require signing up online in advance. At my University’s gym, they offer 2 hour slots throughout the day, each of which open 6 hours in advance for reservation. Because the demand for time slots hea..."
url: "https://hashnode.com/posts/create-an-automated-web-bot-with-selenium-in-python/6092f118a7a3827bb64ccee6"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Create an Automated Web Bot with Selenium in Python](https://tmonty.tech/create-an-automated-web-bot-with-selenium-in-python?utm_source=hashnode&utm_medium=feed)

Motivation Due to the pandemic, a lot of activities require signing up online in advance. At my University’s gym, they offer 2 hour slots throughout the day, each of which open 6 hours in advance for reservation. Because the demand for time slots hea...

May 5, 2021 · 11 min read · tmonty.tech  
Updated Jun 6, 2021  
Read the article

-   [#python](https://hashnode.com/tag/python)
-   [#productivity](https://hashnode.com/tag/productivity)
-   [#selenium](https://hashnode.com/tag/selenium)
-   [#tutorial](https://hashnode.com/tag/tutorial)

## Written by

[Thomas Montfort](https://hashnode.com/@tmonty)

@tmonty · New Jersey, USA

  
[View profile](https://hashnode.com/@tmonty)

Aspiring Software Engineer documenting my journey | Python development | Crypto and DeFi space

I am sophomore CS student at Syracuse University interested in trending technologies like blockchain and enjoy documenting/sharing my experience with the tech community.

## Responses 2

Markdown supported · ⌘↵ to post

[Dylan Stavish](https://hashnode.com/@DJStavish)

[Mar 30, 2022](https://hashnode.com/posts/create-an-automated-web-bot-with-selenium-in-python/6092f118a7a3827bb64ccee6/comment/62445554fb90d6eb6fb2b2c6)

Hi there, great code!!! I am trying to do the same with my university but I am struggling with it, as a complete noob. I wondered if you could quickly look at my problem. Basically, my University is organizing the bookings into a table format. As an example (below) I would like to book Spinning at 12:15 on Thursday 31st of March. The XPATH for the word Spinning is: //\*\[@id="booking-details"\]/tbody/tr\[7\]/td\[2\] and it's element is : <td data-bind="text: name" class="name">Spinning</td>

The XPATH for the Select button is: //\*\[@id="booking-details"\]/tbody/tr\[7\]/td\[6\]/a and it's element is : <a class="btn primary-color select-booking" data-bind="attr: { 'data-id': id, 'data-start': start }" data-id="TDLH5BQ7GBT01Z3" data-start="Thu Mar 31 2022 12:15:00 GMT+0000">SELECT</a>

I can't simply search for the time as Zumba and Spinning are both that time. There are multiple Spinning as well. But the Spinning i want and my button have the same beginning //\*\[@id="booking-details"\]/tbody/tr\[7\]/

Do you know how I could find the beginning of the XPATH that matches both and use that to find the button? The table is dynamic and changes according to date and availability.

Any help would be greatly appreciated!!!

Unfortunately as a new user, i can't post screenshots yet. The table is like this:

Thursday 31st March Spinning 07:15 SELECT HiiT 08:15 SELECT Spinning 12:15 SELECT Zumba 12:15 SELECT

[Dylan Stavish](https://hashnode.com/@DJStavish)

[Mar 31, 2022](https://hashnode.com/posts/create-an-automated-web-bot-with-selenium-in-python/6092f118a7a3827bb64ccee6/comment/62445554fb90d6eb6fb2b2c6#reply-62459d2893b269f2e37431e9)

I managed to solve my problem with this: driver.find\_element\_by\_xpath("//tbody/tr/td\[contains(text(), 'Spinning')\]/../td\[6\]/a\[@data-start='Thu Mar 31 2022 12:15:00 GMT+0000'\]")

[Nelson Ekene](https://hashnode.com/@KafkaTech)

[Dec 23, 2021](https://hashnode.com/posts/create-an-automated-web-bot-with-selenium-in-python/6092f118a7a3827bb64ccee6/comment/61c46eb84d0ac038882a2454)

I enjoyed reading your writing, it was eye-opening I must say but I have a couple of questions to ask : 1) can I automate the bot to make appointments for many people apart from me at the same time, if there are 9 available spaces for just 9 people, can I make appointments for 9 of them at the same time? 2) if number 1 is possible, Will the bot work based on my internet speed or what? 3) what if there's a captcha in place? I'd appreciate your response.

[Eleftheria Batsou](https://hashnode.com/@eleftheriabatsou)

[May 7, 2021](https://hashnode.com/posts/create-an-automated-web-bot-with-selenium-in-python/6092f118a7a3827bb64ccee6/comment/6094f130a7a3827bb64cf173)

This is actually a great idea. We had the same problem in the university, not for the gym but for booking slots with a professor... that bot would have been so handy!

[Thomas Montfort](https://hashnode.com/@tmonty)

[May 7, 2021](https://hashnode.com/posts/create-an-automated-web-bot-with-selenium-in-python/6092f118a7a3827bb64ccee6/comment/6094f130a7a3827bb64cf173#reply-60957bac51821218caddbe90)

Yeah it might require some time and work upfront but is definitely worth it!
