I can’t click on 5 stars in Google Maps [closed]

I am writing an automatic scoring tool in Google Maps. I managed to get it to the scoring tab, but I cannot give 5 stars there and press the send button. There is a problem in giving 5 stars.

Hre is my code block:

from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from webdriver_manager.chrome import ChromeDriverManager
import os
import time

def google_maps_comment_with_existing_profile(comment_text):
    # Kullanıcı verileri ve profil yolu
    user_data_dir = os.path.expanduser('~') + "\AppData\Local\Google\Chrome\User Data"
    profile = "Profile 1"  # veya "Profile 1", "Profile 2" gibi

    # Chrome seçeneklerini ayarlama
    chrome_options = Options()
    chrome_options.add_argument(f"user-data-dir={user_data_dir}")
    chrome_options.add_argument(f"profile-directory={profile}")
    chrome_options.add_argument("--start-maximized")
    
    # Chrome'u başlatma
    service = Service(ChromeDriverManager().install())
    browser = webdriver.Chrome(service=service, options=chrome_options)
    
    try:
        # Google Maps'te mekana git
        browser.get("https://www.google.com/maps/place/Aspava+D%C3%BCr%C3%BCm+D%C3%B6ner/@37.0739082,37.3154215,13.75z/data=!4m6!3m5!1s0x1531e1a012adbbd3:0xb0211d1d7239889d!8m2!3d37.072678!4d37.3392742!16s%2Fg%2F1tgldpqs?entry=ttu")
        time.sleep(5)
        
        # Yorumlar sekmesine tıkla
        reviews_tab = WebDriverWait(browser, 10).until(
            EC.element_to_be_clickable((By.XPATH, '//button[contains(., "Yorumlar")]'))
        )
        reviews_tab.click()
        time.sleep(3)
        
        # Yorum yaz butonunu bul ve tıkla
        write_review_button = WebDriverWait(browser, 10).until(
            EC.element_to_be_clickable((By.XPATH, '//button[contains(., "Yorum yaz")]'))
        )
        write_review_button.click()
        
        # iframe'e geçiş yap
        iframe = WebDriverWait(browser, 10).until(
            EC.presence_of_element_located((By.XPATH, '//iframe[@name="goog-reviews-write-widget"]'))
        )
        browser.switch_to.frame(iframe)
        
        # Yıldız derecelendirmesi ve yorum yazma alanının görünür olmasını bekle
        star_xpath = '//div[@aria-label="Puanlama yıldızları"]//div[@aria-label="Beş yıldız"]'
        comment_box_xpath = '//textarea[@aria-label="Yorumunuzu yazın"]'

        # Derecelendirme yıldızları ve yorum yazma alanının görünür olmasını bekle
        WebDriverWait(browser, 10).until(
            EC.visibility_of_element_located((By.XPATH, star_xpath))
        )
        WebDriverWait(browser, 10).until(
            EC.visibility_of_element_located((By.XPATH, comment_box_xpath))
        )
        
        # Beş yıldız derecelendirmesine tıklama
        star_rating = WebDriverWait(browser, 10).until(
            EC.element_to_be_clickable((By.XPATH, star_xpath))
        )
        browser.execute_script("arguments[0].click();", star_rating)
        print("Beş yıldız derecelendirmesine tıklandı.")
        
        # Yorum alanına yorum yaz
        comment_box = WebDriverWait(browser, 10).until(
            EC.presence_of_element_located((By.XPATH, comment_box_xpath))
        )
        comment_box.send_keys(comment_text)
        time.sleep(2)

        # Yorum gönder
        post_button = WebDriverWait(browser, 10).until(
            EC.element_to_be_clickable((By.XPATH, '//button[@data-action-type="post"]'))
        )
        post_button.click()
        time.sleep(5)

        print("Yorum başarıyla gönderildi.")
        
    except Exception as e:
        print(f"Yorum gönderme sırasında hata: {e}")

    finally:
        # Tarayıcıyı kapatmadan önce kullanıcıdan onay al
        input("İşlem tamamlandı. Tarayıcıyı kapatmak için Enter'a basın...")
        browser.quit()

# Gönderilecek yorum
comment = "Harika bir yer, kesinlikle tavsiye ederim!"

# Yorumları gönder
google_maps_comment_with_existing_profile(comment)

When I examined the page, I noticed that an iframe opened when I clicked on the comment section and I acted accordingly, but I failed.

New contributor

Karambol is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

1

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật