Reputation: 163
Facebook handles posting to a page you are the admin of differently then they do a personal page or a group you aren't and admin of (where there is a text area). I can select the text box which I think Facebook treats as a button but I can't send text to it. I receive this error when I try to: "selenium.common.exceptions.WebDriverException: Message: unknown error: cannot focus element"
driver.get("https://www.facebook.com/libertyempireband/")
sleep(8)
post_box=driver.find_element_by_xpath('//*[@id="rc.u_0_22"]/div/div[1]/div/div[2]/div/div[1]')
#selects text box which I think is a button
post_box.click()
sleep(5)
poster_box=driver.find_element_by_xpath('//*[@id="rc.u_0_22"]')
#attempts to type in textbox, but recieve a "can't focus element" error
poster_box.send_keys("hey")
Upvotes: 0
Views: 741
Reputation: 163
I fixed it! The post_box Variable (the one I had to send text to) after clicking the first element labeled(post_box). This will help anyone trying to automate their group posts!
driver.find_element_by_xpath("//div[@contenteditable='true']")
Hope this helps someone!
Upvotes: 2