I want to extract users from a website bu using for loop, but i don't know how can i put correctly "i" instead of number 1
after i put
user_id = browser.find_element_by_xpath("(//div[@class='_gzjax'])["+str(i)+"]").text
Traceback (most recent call last): File "D:/Code/Python/Instagram Unfollow/Instagram Unfollow.py", line 32, in user_id = browser.find_element_by_xpath("(//div[@class='_gzjax'])["+str(i)+"]").text File "C:\Python33\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 293, in find_element_by_xpath return self.find_element(by=By.XPATH, value=xpath) File "C:\Python33\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 752, in find_element 'value': value})['value'] File "C:\Python33\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 236, in execute self.error_handler.check_response(response) File "C:\Python33\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 192, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: {"method":"xpath","selector":"(//div[@class='gzjax'])[0]"} Stacktrace: at FirefoxDriver.prototype.findElementInternal (file:///c:/users/viktor/appdata/local/temp/tmp1r0vgw/extensions/[email protected]/components/driver-component.js:10770) at FirefoxDriver.prototype.findElement (file:///c:/users/viktor/appdata/local/temp/tmp1r0vgw/extensions/[email protected]/components/driver-component.js:10779) at DelayedCommand.prototype.executeInternal_/h (file:///c:/users/viktor/appdata/local/temp/tmp1r0vgw/extensions/[email protected]/components/command-processor.js:12661) at DelayedCommand.prototype.executeInternal_ (file:///c:/users/viktor/appdata/local/temp/tmp1r0vgw/extensions/[email protected]/components/command-processor.js:12666) at DelayedCommand.prototype.execute/< (file:///c:/users/viktor/appdata/local/temp/tmp1r0vgw/extensions/[email protected]/components/command-processor.js:12608)