Please find the attached image i want to fetch the Admins and moderators name and href link .
i have tried below :
grp="https://m.facebook.com/groups/162265541050378?view=members&ref=m_notif¬if_t=group_r2j_approved"
driver.get(grp)
root1=driver.find_element_by_id("//*[@id='rootcontainer']")
if root1>0:
admin=driver.find_elements_by_xpath("//*[@class='_4kk6 _5b6s']")
ilink = admin.get_attribute('href')
ilink2=admin.get_attribute('<a>')
print(ilink)
error
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"[id="//*[@id='rootcontainer']"]"}
(Session info: chrome=91.0.4472.101)
for Admins and moderators name you can do this :
for names in driver.find_elements(By.XPATH, "//div[contains(@id, 'member_')]/div[2]/descendant::h3[1]")
print(names.text)
for href :
for hrefs in driver.find_elements(By.XPATH, "//div[contains(@id, 'member_')]/div[4]/descendant::a")
print(hrefs.get_attribute('href'))