In this tutorial, we’ll create a simple zoom bot that can attend zoom meetings automatically using python selenium and pyautogui.
How to Auto Join Zoom Meetings Using Python
Let’s now create up the auto-join bot to connect to Zoom meetings. This bot will connect to a specific link based on the set time.
1. Install Selenium and Pyautogui
pip install selenium pip install pyautogui
Other than these modules we also need to download the chrome or firefox webdriver. It is essential that the version of both webdriver and web browser are the same, which you may find to download at their official browser sites or with a simple google search.
Recommended Read: Installing Web Driver in Selenium Python
from selenium import webdriver import pyautogui as py import time
After importing the necessary modules we now need to initialize the webdriver. In the following code, we will pass the path of the webdriver.
driver = webdriver.Chrome(Path of downloaded chrome webdriver)
2. Opening Zoom And Getting The Required Information
Now that our setup is complete we can start coding our bot to attend meetings automatically.
In order to attend any meeting on zoom, we need a meeting id and passcode. So we’ll save both in a variable. This link will open the zoom join meeting webpage.
driver.get('https://zoom.us/join') # --> storing meeting id and passcode, you may also take this as an input in your code from the user meet_code = "275 816 9386" passcode = "9pX9pT"
3. Finding The Web Elements
When we try to join a meeting, from the Zoom client we are presented with the authentication page, which we also get by fetching the URL in the previous step, webpage asking for a meeting code.
We’ll inspect the id box and join button in order to find their xpath so we can locate the elements and automate these actions using selenium. In the code below we’ve found the id box first and gave it our meeting code using the send keys method.
After the meeting code is filled we will click on the join button to go to the next step.
Our bot will imitate the same human behavior for inputting values and joining the meeting.
# finding id text box and sending it our meeting code. element_box = driver.find_element_by_xpath("//input[@id='join-confno']") element_box.send_keys(meet_code) #waiting for 2 seconds to send the code time.sleep(2) #finding the join button and clicking on it Btn = driver.find_element_by_xpath("//a[@id='btnSubmit']") Btn.click()
4. Use Pyautogui To Type The Passcode
After clicking the join button, the zoom client will open which will ask you to enter the passcode for the meeting. So to find the text box to enter the passcode and submit button we’ll use pyautogui. We’ll take the screenshot of the input field and submit button and save it in the same directory as our python file.
Using pyautogui’s locateCenterOnScreen(‘image_path’) we’ll find the center coordinate of these images on the screen and we’ll pass these coordinates to the moveTo() method which will move our cursor to the text field and button.
enter_passcode = py.locateCenterOnScreen('passcode.png') py.moveTo(enter_passcode) py.click() py.write(passcode)
In the above code, we’ve found the text box and filled it with the write method.
btn = py.locateCenterOnScreen("zoom\join.png") py.moveTo(btn) py.click()
And just like that, we’ll be able to attend any meeting automatically on a simple run of a python script.
Also read: Auto-Type Text Using Python
Complete Python Script to Auto Join Zoom Meetings
Final code for the bot:
from selenium import webdriver import pyautogui as py import time passcode = "9pX9PT" meet_code = "272 916 9386" def join(meet, password): driver = webdriver.Chrome('C://software/chromedriver.exe') driver.get('https://zoom.us/join') time.slee(5) #to let the webpage open completely driver.find_element_by_xpath("//input[@id='join-confno']").send_keys(meet_code) time.sleep(2) driver.find_element_by_xpath("//a[@id='btnSubmit']").click() time.sleep(5) # enter passcode enter_passcode = py.locateCenterOnScreen('passc.png') py.moveTo(enter_passcode) py.click() py.write(passcode) # join the meeting time.sleep(5) btn = py.locateCenterOnScreen("join.png") py.moveTo(btn) py.click() join(meet_code,passcode)
Further in this script can be an approach to join and leave the meeting at a particular time. Also, you may build a bot for any other meeting client like Google Meet, Microsoft Teams, etc. using the above-discussed approach.
That’s it for the bot. Hope you learned well how to create a bot that joins Zoom meetings automatically and are ready to build a bot for your meetings and automate the task.