0

I am trying to retrieve information (including reviews) about the app from google play store. Some of the reviews are short in length and some reviews are long and has got full review button. When the page is loaded on the browser, I want to execute click command so that it click on all review button of the reviews (if any) and then start extracting information from the page. Here is my code:

baseurl='https://play.google.com/store/apps/details?id=com.zihua.android.mytracks&hl=en&showAllReviews=true'
driver.get(baseurl)

WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, "//div[@class='d15Mdf bAhLNe']//div[@class='cQj82c']/button[text()="Full Review"]"))).click()

person_info = driver.find_elements_by_xpath("//div[@class='d15Mdf bAhLNe']")
for person in person_info:
    review_response_person = ''
    response_date = ''
    response_text = ''

    name = person.find_element_by_xpath(".//span[@class='X43Kjb']").text
    review = person.find_element_by_xpath(".//div[@class='UD7Dzf']/span").text

However, program throws following error on third line of the code (i.e. WebDriverWait(driver,10)):

ElementClickInterceptedException: Message: element click intercepted: Element <button class="LkLjZd ScJHi OzU4dc  " jsaction="click:TiglPc" jsname="gxjVle">...</button> is not clickable at point (380, 10). Other element would receive the click: <a href="/store/apps" class="L9ZZW uJjCzb">...</a>

Could anyone guide me how to fix the issue?

user2293224
  • 2,128
  • 5
  • 28
  • 52

1 Answers1

0

It looks as though the full review is inside the span just below the visible trimmed review (jsname="fbQN7e") so you could do something like this

driver.get("https://play.google.com/store/apps/details?id=com.zihua.android.mytracks&hl=en&showAllReviews=true")
reviews = WebDriverWait(driver, 10).until(
    EC.presence_of_element_located((By.XPATH, "//div[@jsname='fk8dgd']"))
)
for review in reviews.find_elements(By.CSS_SELECTOR, "div[jscontroller='H6eOGe']"):
    reviewText = review.find_element(By.CSS_SELECTOR, "span[jsname='fbQN7e']")
    print(reviewText.get_attribute("innerHTML"))

However, that will likely only return one review, you'll need to scroll the page down to the bottom so that they're all loaded in. There are other answers which give good examples on how to do that. Once added, it will iterate over each full review without the need to click a button to expand.

Lucan
  • 2,907
  • 2
  • 16
  • 30