I'm trying to automate the clicking of the "SHOW MORE" button at the bottom of the page to get all the reviews there is.
However, I'm having some problems locating it and would really appreciate it if you could help me out.
I have tried a couple of methods but I am not sure why none of them work.
1) Method 1: CSS Selector
driver.find_element_by_css_selector("U26fgb.O0WRkf.oG5Srb.C0oVfc.n9lfJ.M9Bg4d")
leads to:
NoSuchElementException: Message: no such element: Unable to locate element
2) Method 2 : XPath Helper (an extension on Chrome)
driver.find_element_by_xpath("/html/body[@id='yDmH0d']/div[@id='fcxH9b']/div[@class='WpDbMd']/c-wiz[@class='zQTmif SSPGKf I3xX3c drrice']/div[@class='T4LgNb']/div[@class='ZfcPIb']/div[@class='UTg3hd']/div[@class='JNury Ekdcne']/div[@class='LXrl4c']/div/div[@class='W4P4ne ']/div[2]/div[@class='PFAhAf']/div[@class='U26fgb O0WRkf oG5Srb C0oVfc n9lfJ']/span[@class='CwaK9']/span[@class='RveJvd snByac']")
leads to the same error as above.
3) Method 3 : WebDriverWait
I read the other stack overflow questions related to this and tried using WebDriverWait and here is my code:
WebDriverWait(driver, 15).until(EC.presence_of_element_located((By.XPATH, "/html/body[@id='yDmH0d']/div[@id='fcxH9b']/div[@class='WpDbMd']/c-wiz[@class='zQTmif SSPGKf I3xX3c drrice']/div[@class='T4LgNb']/div[@class='ZfcPIb']/div[@class='UTg3hd']/div[@class='JNury Ekdcne']/div[@class='LXrl4c']/div/div[@class='W4P4ne ']/div[2]/div[@class='zc7KVe']/div[@class='d15Mdf bAhLNe']/div[@class='xKpxId zc7KVe']/div[@class='bAhLNe kx8XBd']/span[@class='X43Kjb']"))).click()
but was faced with TimeoutException
4) I came across another question on changing frames when faced with such errors but it seems like I don't have a frame to switch to (Do correct me if I'm wrong)
This is the url of the page: https://play.google.com/store/apps/details?id=com.Daylight.EzLinkAndroid&hl=en_SG
The HTML that I have problems with is as follows:
<div class="PFAhAf" jscontroller="XO1Ihd" jsaction="JIbuQc:bRsdTc(i3y3Ic);">
<div role="button" class="U26fgb O0WRkf oG5Srb C0oVfc n9lfJ M9Bg4d
j7nIZb" jscontroller="VXdfxd" jsaction="click:cOuCgd;
mousedown:UX7yZ; mouseup:lbsD7e; mouseenter:tfO1Yc;
mouseleave:JywGue; focus:AHmuwe; blur:O22p3e;
contextmenu:mg9Pef;touchstart:p6p2H; touchmove:FwuNnf;
touchend:yfqBxc(preventMouseEvents=true|preventDefault=true);
touchcancel:JMtRjd;j9grLe:.CLIENT;HUObcd:.CLIENT" jsshadow=""
jsname="i3y3Ic" aria-disabled="false" tabindex="0">
<div class="Vwe4Vb MbhUzd" jsname="ksKsZd" style="top: 17.2px;
left: 70.225px; width: 98px; height: 98px;"></div>
<div class="ZFr60d CeoRYc"></div><span jsslot="" class="CwaK9">
<span class="RveJvd snByac">Show more</span>
</span>
</div>
</div>
Sorry for the long post and thank you for your help! :)