E
E
Eva052016-09-30 16:54:50
Python
Eva05, 2016-09-30 16:54:50

How to pass value to Instagram search string using Selenium (Python)?

Good day everyone!
I'm new to Selenium and I'm trying to pass a specific nickname to the Instagram search field.
There is a code:

username="USERNAME"
password="PASSWORD"
driver=webdriver.Chrome("C:\\Users\\ME\\Downloads\\chromedriver_win32\\chromedriver.exe")
driver.get("https://www.instagram.com/accounts/login/")
driver.find_element_by_xpath("//div/input[@name='username']").send_keys(username)
driver.find_element_by_xpath("//div/input[@name='password']").send_keys(password)
driver.find_element_by_xpath("//span/button").click()
driver.find_element_by_xpath("//input[@placeholder='Поиск']").send_keys('NICKNAME')

I successfully log in, go to my account, but the "Search" field does not think to be filled
in. This is how the code of the search string looks like.
5111658fd20a4500bdc54d76f1ee56f4.png
Please tell me what I'm doing wrong?
If I just change the last line to the address of the page I'm interested in,
https://www.instagram.com/NICKNAME/
then the browser successfully redirects me to the address of this page, but only now, it again offers me to enter the site again
f629b26decdf40279e743401e71e57be.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Ivan, 2016-09-30
@Eva05

driver = webdriver.Firefox()
checked - works for me

D
Dimonchik, 2016-09-30
@dimonchik2013

www.telerik.com/fiddler

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question