0

so what I am trying to do is create a auto sign in to google meet. Before the code runs, it asks for the code of the lesson which I store it in a variable called "lesson_code" and I want to combine it with the string of the link + lesson code.

So after signing in to gmail it redirects to google meet , since I did quite struggled with the buttons and xml thought of simply opening a new tab which would save quite a lot of time and it is slightly easier to achieve.

def open_chrome():
    # create a new Chrome session
    driver = webdriver.Chrome('C:\driver\chromedriver.exe')
    driver.implicitly_wait(30)
    driver.maximize_window()
    # navigate to the application home page
    driver.get("https://accounts.google.com/")
    #get the username textbox
    login_field = driver.find_element_by_name("identifier")
    login_field.clear()
    #enter username
    login_field.send_keys(username)
    login_field.send_keys(u'\ue007') #unicode for enter key
    time.sleep(4)
    #get the password textbox
    password_field = driver.find_element_by_name("password")
    password_field.clear()
    #enter password
    password_field.send_keys(password)
    password_field.send_keys(u'\ue007') #unicode for enter key
    time.sleep(10)
    #navigate to google.meet
    googlemeet =driver.get("meet.google.com/"+lesson_code)
    time.sleep(5)

It does work up to the point of gmail, but it stops working at

googlemeet =driver.get("meet.google.com/"+lesson_code)

the lesson code is stored like this:

lesson_code=input("Whats is your code : ")

2 Answers2

0

Well, you shouldn't be omitting the protocol https://, that is what is causing the error. You don't really need to assign the driver.get() call either.

Opening in other tabs and changing focus seems to give problems to a lot of people. If you run googlemeet = driver.get("https://meet.google.com/"+lesson_code) it will likely open in a whole new window, so I usually use some JS injection to do this.

    # Create url
    googlemeet = "https://meet.google.com/" + lesson_code
    # Inject JS to open new tab
    driver.execute_script("window.open(arguments[0])", googlemeet)
    # Switch focus to new tab
    driver.switch_to.window(driver.window_handles[1])

If you don't want to use injection for some reason, you can see this answer

Boomer
  • 464
  • 3
  • 10
0

You need to pass https or http to in your url too

so do googlemeet = driver.get("https://meet.google.com/"+lesson_code)

kennysliding
  • 2,783
  • 1
  • 10
  • 31