Could you make an example with the site? I want to ignore the posts with comments and just click the ones without comments.
from selenium import webdriver import time path = "C:\chromed\chromedriver.exe" driver = webdriver.Chrome(path) #path ''' ''' driver.get("http://cineaste.co.kr/") #url time.sleep(0.5) postclick = driver.find_element_by_xpath("//h3[.='영화이야기']/following::div[@class='widget-small-box'][1]//li[@class='ellipsis'][not(contains(.,'+'))]") #로그인창 활성화 postclick.click() driver.close()
I tried this, but there was an error.
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//h3[.='영화이야기']/following::div[@class='widget-small-box'][1]//li[@class='ellipsis'][not(contains(.,'+'))]"} (Session info: chrome=81.0.4044.138)
I want to click on a post that doesn't have any comments yet. And I want to skip posts with comments. I'm still a beginner. Help me.