Selenium uc, google chrome cant click button in google meet

76 Views Asked by At

I want to press the "continue without microphone" button. No matter how I try to find it and press it, I can't :C I tried Selenium IDE and I managed to click it, but after converting it into python code it doesn't work either.

screenshot '

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import undetected_chromedriver as uc

options = webdriver.ChromeOptions()
options.add_argument('--no-default-browser-check')
options.add_argument('--safebrowsing-disable-download-protection')
options.add_argument('--disable-popup-blocking')
options.add_argument('--disable-web-security')
options.add_argument('--no-sandbox')
#options.add_argument("--disable-infobars")
#options.add_argument("--disable-notifications") #And why is it that if I enable this option,     Google won't let me in at all.
driver = uc.Chrome(options=options)
driver.get('https://meet.google.com/oqm-zoqm-wmx')
try:
    element = WebDriverWait(driver, 10).until(
        EC.presence_of_element_located((By.CSS_SELECTOR, ".VfPpkd-ksKsZd-mWPk3d-OWXEXe-Tv8l5d-    lJfZMc > .VfPpkd-vQzf8d"))
    )
    element.click()

except Exception as e:
    print(f"{str(e)}")

finally:
    while True:
        pass

'

2

There are 2 best solutions below

0
WAVE Cheeez On
element = WebDriverWait(driver, 10).until(
        EC.presence_of_element_located((By.XPATH, 
"/html/body/div/div[3]/div[2]/div/div/div/div/div[2]/div/div[2]/button"))
    )
    element.click()

And I don't know why it suddenly works...

1
Abdel Ysf On

I think changing the manner with which you locate it fix the problem, I have tried to locate the button by the containing text, and it worked for me.

Here is the code I have tried in my machine :

import ssl
import time

import certifi
from selenium import webdriver
from selenium.webdriver.common.by import By
import undetected_chromedriver as uc

# Set the CA certificate bundle path
ssl._create_default_https_context = ssl._create_unverified_context
ssl._create_default_https_context(cafile=certifi.where())

if __name__ == '__main__':

options = webdriver.ChromeOptions()
options.add_argument('--no-default-browser-check')
options.add_argument('--safebrowsing-disable-download-protection')
options.add_argument('--disable-popup-blocking')
options.add_argument('--disable-web-security')
options.add_argument('--no-sandbox')
options.headless = False
driver = uc.Chrome(options=options)

# Set the implicit wait time (in seconds)
driver.implicitly_wait(10)  # Wait up to 10 seconds

driver.get('https://meet.google.com/oqm-zoqm-wmx')

time.sleep(10)  # Wait for the page to load
try:

    element = driver.find_element(By.XPATH, "//*[contains(text(), 'Continue without microphone and camera')]")
    element.click()

    time.sleep(10)  # sleep for 10 seconds to see that the button was actually clicked

except Exception as e:
    print(f"{str(e)}")
finally:
    driver.quit()