2

I have this block of code.

    if scroll:
        for x in range(0,scroll):
            print ("Rescrolling username=>",self.username)
            time.sleep(3)
            self.driver.execute_script(self.SCROLLSCRIPT)
        time.sleep(3)
    posts = self.driver.find_elements_by_css_selector("article.feed-item")
    print(str(len(posts)) + " posts found.")
    targets = []
    for post in posts:
        targets.append(post.find_element_by_class_name("new-profile-icon").get_attribute("title"))
    print "Total targets found => ", len(targets)
    return targets

For some reason here I am getting an error on line 21.

print "Total targets found => ", len(targets)
                              ^
SyntaxError: invalid syntax

I can't figure out why this is happening.

0 Answers0