By anandu4115
So I am trying to automate my google meet classes using selenium and python. So when I run the code it opens up chrome and then it freezes and opens another chrome and all the commands are executed in the second window. I can’t understand why because I only need 1 window and it’s opening 2. anyway pls help me fix this . and also my code is split into different files so I am only going to give the main file. Some of the imports are from the other files so just check my main code if u want I can give the rest. this is my code:
import time
from test import *
from do import *
from datetime import datetime
from datetime import date
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.chrome.options import Options
chrome_options = webdriver.ChromeOptions()
prefs = {"profile.default_content_setting_values.media_stream_mic" : 1,
"profile.default_content_setting_values.notifications": 2,
"profile.default_content_setting_values.media_stream_camera": 1}
chrome_options.add_experimental_option("prefs",prefs)
path = r'C:\Users\User\Documents\chromedriver_win32 (2)\chromedriver.exe'
driver = webdriver.Chrome(path, chrome_options=chrome_options)
email = "example@gmail.com"
password = "blah123"
driver.get('https://accounts.google.com/o/oauth2/v2/auth/oauthchooseaccount?redirect_uri=https%3A%2F%2Fdevelopers.google.com%2Foauthplayground&prompt=consent&response_type=code&client_id=407408718192.apps.googleusercontent.com&scope=email&access_type=offline&flowName=GeneralOAuthFlow')
time.sleep(3)
driver.find_element_by_xpath('//*[@id="yDmH0d"]').click()
driver.find_element_by_xpath('//input[@type="email"]').send_keys(email)
driver.find_element_by_xpath('//*[@id="identifierNext"]').click()
time.sleep(3)
driver.find_element_by_xpath('//input[@type="password"]').send_keys(password)
driver.find_element_by_xpath('//*[@id="passwordNext"]').click()
time.sleep(2)
e = datetime.now()
day = e.strftime ( "%A" )
print ( day )
if day == "Monday":
driver.get(joinmath())
time.sleep(3000)
driver.get(joinphy())
time.sleep(3000)
driver.get ( joinhistory() )
time.sleep ( 3000 )
driver.get ( joinenglish )
elif day == "Tuesday":
driver.get ( joinmath() )
time.sleep ( 3000 )
driver.get ( joinhistory() )
time.sleep ( 3000 )
driver.get ( joinmal())
time.sleep ( 3000 )
driver.get ( joinbio() )
elif day == "Wednesday":
driver.get ( joinchem() )
time.sleep ( 180 )
driver.get ( joinmath() )
time.sleep ( 180 )
driver.get ( joinenglish())
time.sleep ( 180 )
driver.get ( joinhindi() )
elif day == "Thursday":
driver.get ( joinmath () )
time.sleep ( 3000 )
driver.get ( joinface () )
time.sleep ( 3000 )
driver.get ( joinenglish () )
time.sleep ( 3000 )
driver.get ( joinmal () )
elif day == "Friday":
driver.get ( joinmath () )
time.sleep ( 3000 )
driver.get ( joingeo () )
time.sleep ( 3000 )
driver.get ( joinmal() )
time.sleep ( 3000 )
driver.get ( joinphy () )
elif day == "Saturday":
print('its saturday bro lmao ')
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hi there @anandu4115,
Indeed, I was able to reproduce the problem at my end but I don’t see anything about this case mentioned in the official documetnation.
Have you tried following the steps fro this documentation here:
https://www.browserstack.com/docs/automate/selenium/handle-permission-pop-ups#python
Regards, Bobby
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.