0

I am trying to write a bot via selenium-webdriver that auto posts to instagram.

The flow I'm following is:

  1. Open instagram
  2. Log in
  3. Switch to developer tools, switch to mobile mode, refresh page(this shows posting button)
  4. Click posting "plus" button.
  5. Use keyboard events to select pictures from pc
  6. Blah blah you know the rest.

I am getting tripped up at step 4.

I have found the xpath of the Post button in the browser.

elem = driver.find_element_by_xpath("//span[@class='glyphsSpriteNew_post__outline__24__grey_9 u-__7']")

but when I press elem.click right after, I get a right-click instead, and my terminal stalls. I have to cntrl-c to get out of it and it shuts down my browser.

I've also tried to select the area around the post 'plus' button:

elem = driver.find_element_by_xpath("//div[@class='q02Nz _0TPg']")
elem.click()

This does the same thing.

Does anyone have experience with this? Is this intentional on Facebook's part to screw with botters?

I have not tried on firefox yet.

1 Answers1

0

Can you try double click:

Actions actions = new Actions(driver);
elem = driver.find_element_by_xpath("//span[@class='glyphsSpriteNew_post__outline__24__grey_9 u-__7']");
actions.doubleClick(elem ).perform();

This might be a possible workaround also:

JavaScript simulate right click through code

Madison Courto
  • 1,231
  • 13
  • 25