title: Post Instagram Stories using selenium/chromedriver in python
body: <p>I want to create a bot that takes in a folder path and posts all of its img contents to a instagram users story using python and chromedriver (I already have a lot of other functionalities working using this set up so I would prefer to solve this issue using these tools). If anyone has created or found something similar to what I'm describing please comment the link.</p>
  
  <p>I have tried using mobile-emulation mode for chromedriver with some success. I was able to get to the file selection screen, but when I returned to instagram it was no longer doing mobile emulation and locked the UI (it was asking to rotate the device). I included the options that I have currently selected for the webdriver that I'm using. I also included the def that I use to upload a file to the story. </p>
  
  <pre class="lang-py prettyprint-override"><code>    def __init__ (self, username, password, actionstring, inspoaccounts, 
      inspohashtags) :
          self.username = username
          self.password = password
          self.actionString = str(actionstring)
          self.inspoAccounts = (str(inspoaccounts).split('|', 30))
          self.inspoHashtags = (str(inspohashtags).split('|', 30))
          cOptions = Options()
          cOptions.add_argument("--incognito")
          cOptions.add_argument("--start-maximized")
          cOptions.add_argument('--user-agent="Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; Microsoft; Lumia 640 XL LTE) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Mobile Safari/537.36 Edge/12.10166"')
          self.driver = webdriver.Chrome(executable_path="venv/Lib/chromedriver_win32/chromedriver.exe", options=cOptions)
          self.driver.delete_all_cookies()
  </code></pre>
  
  <pre class="lang-py prettyprint-override"><code>    def uploadStory(self, path):
          path = self.cleanPath(path)
          actions = ActionChains(self.driver)
          element = self.driver.find_element_by_css_selector(
              '#react-root &gt; section &gt; main &gt; section &gt; div.zGtbP &gt; div &gt; div &gt; div &gt; div:nth-child(1) &gt; button')
  
          #THIS IS WHERE IT ASKS ME TO ROTATE MY DEVICE
  
          actions.move_to_element(element)
          actions.click()
          actions.perform()
          time.sleep(random.randint(3, 6))
          autoit.win_activate("Open")
          time.sleep(random.randint(4, 6))
          autoit.control_send("Open", "Edit1", path)
          time.sleep(random.randint(3, 7))
          autoit.control_send("Open", "Edit1", "{ENTER}")
          time.sleep(random.randint(3, 6))
          self.driver.find_element_by_xpath("//*[@id=\"react-root\"]/section/footer/div/div/button").click()
  </code></pre>
  
  <p>If anyone has any ideas or any projects feel free to comment. There are no wrong answers</p>