I'm fluent with using python selenium, but it didn't work on the new facebook design page
If anyone have the new facebook page please check if you can detect any element using python on this page : https://www.facebook.com/messages/t/
for example looking for this xpath : //li[@class='_5l-3 _1ht1 _6zk9']
, in browser we'll find 30 elements. but in python when we run our script it won't work :
here is my code :
import time
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
opt = Options()
opt.add_argument("--disable-infobars")
opt.add_argument("start-maximized")
opt.add_experimental_option("prefs", {
"profile.default_content_setting_values.media_stream_mic": 2,
"profile.default_content_setting_values.media_stream_camera": 2,
"profile.default_content_setting_values.geolocation": 2,
"profile.default_content_setting_values.notifications": 2
})
global driver
driver = webdriver.Chrome("yourpathtochromedriver", options=opt)
time.sleep(5)
driver.get("https://www.facebook.com/")
username = driver.find_element_by_xpath("//input[@name='email']")
username.send_keys('youremail')
username = driver.find_element_by_xpath("//input[@name='pass']")
username.send_keys('yourpassword')
driver.find_element_by_xpath("//button[@name='login']").click()
driver.get("https://www.facebook.com/messages/t")
time.sleep(3)
test = driver.find_elements_by_xpath("//li[@class='_5l-3 _1ht1 _6zk9']")
count = (len(test))
print(count)