-2

\Some more Codes

for url in tqdmn(mel.Url[:10], leave=False):

driver.get(url) Url_With_Coordinates.append(driver.find_element_by_css_selector('div[class="ugiz4pqJLAG__primary-text gm2-body-2"]'))

Here is the error message:

no such element: Unable to locate element: {"method":"css selector","selector":"div[class="ugiz4pqJLAG__primary-text gm2-body-2"]"}

HTML Element:

<div jstcache="243" class="ugiz4pqJLAG__primary-text gm2-body-2" jsan="7.ugiz4pqJLAG__primary-text,7.gm2-body-2">Example, 431 St Michale Rd, New York 3004, United States</div>
halfer
  • 19,824
  • 17
  • 99
  • 186

1 Answers1

0

Please use the below line as ugiz4pqJLAG__primary-text and gm2-body-2 are 2 classes and you should always replace white space with . when you have multiple classes.

Url_With_Coordinates.append(driver.find_element_by_css_selector('div[class="ugiz4pqJLAG__primary-text.gm2-body-2"]'))
supputuri
  • 13,644
  • 2
  • 21
  • 39
  • Hi Thank you for the reply – jaya prasanna Jul 07 '20 at 02:55
  • Message: no such element: Unable to locate element: {"method":"css selector","selector":"div[class="ugiz4pqJLAG__primary-text.gm2-body-2"]"} – jaya prasanna Jul 07 '20 at 02:55
  • Can you please check if the locator is working in the chrome devtools. You can refer to https://stackoverflow.com/questions/55870609/is-there-a-way-to-learn-xpath-without-using-firebug-or-xpath-as-firefox-is-not-s/55870909#55870909 – supputuri Jul 07 '20 at 03:17