Radulepy / InstagramBot

Instagram AUTO Like and Comment Python BOT
GNU General Public License v2.0
134 stars 48 forks source link

Error on likeAndComm-function Line 34/35: Unable to locate posts #19

Closed schnalznase closed 1 year ago

schnalznase commented 1 year ago

Error on likeAndComm-function Line 34/35:

I get an error, on line 34/35, where the bot, shall find the posts on the explore-page: my console says: selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"/html/body/div[1]/section/main/div/div[1]/div[1]/div[1]"} (Session info: chrome=111.0.5563.65) Process finished with exit code 1

Could you update the line?

Line 34 / 35 post = browser.find_element_by_xpath( '/html/body/div[1]/section/main/div/div[1]/div/div[' + str(y) + ']/div[' + str(x) + ']')

Radulepy commented 1 year ago

Hi, looks like it can't find the post button. IG updated the post array:

Please change this line:

post = browser.find_element_by_xpath('/html/body/div[1]/section/main/div/div[1]/div/div['+str(y)+']/div['+str(x)+']')

to this:

post = browser.find_element_by_xpath('/html/body/div[2]/div/div/div[1]/div/div/div/div[1]/div[1]/div[2]/section/main/div/div[1]/div/div['+str(y)+']/div['+str(x)+']/div/a/div[2]')

And comment if it works.

schnalznase commented 1 year ago

I changed it by myself. I dont know whether your line does work as well. I am using:

            post = browser.find_element_by_xpath(
                '/html/body/div[2]/div/div/div/div/div/div/div/div/div[2]/section/main/article/div/div/div/div[' + str(y) + ']/div[' + str(x) + ']')

Still thank you for your help, and the repository :-)

Radulepy commented 1 year ago

@schnalznase Glad you fixed it.