I am trying to make a bot that comment on a certain pin on pinterest, the pin has two tabs, photos and comments, I am trying to click on comments so that I can post my comment, I used xpath of that element, but when I ran it, it clicked on a picture below the comment button, I ensured that the xpath is unique, I tried to find it in the console, and it gave me one result which is what I wanted, so I don't understand what is wrong, can someone help me?
pin URL: URL
try:
WebDriverWait(self.browser, 10).until(
EC.visibility_of_element_located((By.XPATH, "//div[contains(text(), 'comments')]")))
except TimeoutException:
pass
else:
sleep(3)
self.browser.find_element_by_xpath('//div[contains(text(), "comments"]').click()
CodePudding user response:
Try closing the "]"
square bracket
CodePudding user response:
Try using:
self.browser.find_element_by_xpath("//div[@data-test-id='canonicalCommentsTab']").click()