0

post_input = WebDriverWait(driver, 5).until(EC.visibility_of_element_located((By.XPATH, "//*[@id='mount_0_0_xb']/div/div[1]/div/div[3]/div/div/div[1]/div[1]/div/div[2]/div/div/div/div[3]/div/div[2]/div/div/div/div[1]/div/div[2]")))

post_input.click()

I want to use selenium to locate Facebook's create post, and then copy the content to be published, but I find that the XPATH will be different each time I copy it. I tried to use the above statement to locate it, and the following error message appeared without any surprise: raise TimeoutException(message, screen, stacktrace) selenium.common.exceptions.TimeoutException: Message: Stacktrace: GetHandleVerifier [0x00007FF6C3CA7012+3522402]

So how should I locate it? Moreover, I found that the class value in the post button element is also very long. Is this intentional on Facebook?Appreciate for any advice in advance.

1
  • I'd target the button's text. Probably "Create Post"? (and drop all that path-based locator stuff) Commented Aug 22 at 21:18

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.