I'm trying to crawl Instagram comments through Selenium.
And i have to press the reply buttons to crawl all the comments. ("답글 보기")
So, i tried to find the xpath of the button, but it's failing.
Here is my attempts
reply_links = driver.find_elements(By.XPATH, "//button[@class='_a9yi']")
reply_links_v2 = driver.find_elements(By.XPATH, '//button[@class="_acan _acao _acas _aj1- _a9yi"]')
reply_links_v3 = driver.find_elements(By.XPATH, '//button[contains(text(),"답글 보기")]')
reply_links_v4 = driver.find_elements(By.XPATH, '//button[@class="_acan _acao _acas _aj1-"]')
output
[]
[]
[]
[<selenium.webdriver.remote.webelement.WebElement (session="4322025fb4271b9a32de3eb510cde52c", element="431ff43b-673a-40d7-9f42-dc91d3ed09e2")>, <selenium.webdriver.remote.webelement.WebElement (session="4322025fb4271b9a32de3eb510cde52c", element="39f44102-6c24-47eb-b8fa-94d61bb4cdc3")>, <selenium.webdriver.remote.webelement.WebElement (session="4322025fb4271b9a32de3eb510cde52c", element="a8a4dc3b-fce0-4633-bc39-27200f4ea40a")>]
The first, second, third Xpath expression failed to locate the element, resulting in an empty list being returned. Last one returns values and clicks work, but it contains buttons that I don't want (for example, follow button).
Here is my button's HTML
<div class="_ab8w _ab94 _ab99 _ab9f _ab9k _ab9p _abcm">
<button class="_acan _acao _acas _aj1-" type="button">
<div class="_a9yh">
</div><span class="_a9yi">답글 보기(1개)</span></button></div>
It's my first time posting a question on Stack Overflow, so I looked it up, but I don't know if I wrote it correctly.
Please let me know if there is anything missing. Thank you!