Python Forum

Full Version: Instagram Phone Emulation
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

I am using selenium.webdriver to open my companies instagram.

I am having issues with getting a comment to input

import autoit
from time import sleep
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.action_chains import ActionChains
username = XXXX
password = XXXX
comment = "awesome!"
getdriver = ("https://www.instagram.com/accounts/login/")

driver = webdriver.Chrome(r'C:\Sol_Drivers\chromedriver_win32\chromedriver.exe')
driver.get(getdriver)

sleep(4)

driver.find_element_by_xpath("//input[@name='username']").send_keys(username)
driver.find_element_by_xpath("//input[@name='password']").send_keys(password)

sleep(4)

driver.find_element_by_xpath("//button[contains(.,'Log In')]").click()

sleep(4)

driver.find_element_by_xpath("//button[contains(.,'Not Now')]").click()

sleep(4)

caption_field = driver.find_element_by_xpath("//textarea[@aria-label='Add a comment…']")
caption_field.send_keys(comment) <Stops working here
The idea is to like add a comment, like a post and move onto the next one.
Any help is appreciated.