0

I'm currently working on my final project for my a levels. I am currently making a selenium bot which is supposed to scrape Instagram stories (take screenshots of them). I have got past all of the logging in process alongside cookies and what not but I am now stuck.

I would like to click on the first available story which hasn't been viewed yet, up to this point I was able to do everything with xpaths but it doesn't look possible here.

However, I found that the button labels include the string ", not seen." shown here: story button html

Is there a way to specifically search for this string in selenium so I can click on it? Thanks in advance.

JeffC
  • 22,180
  • 5
  • 32
  • 55
koppany_b
  • 3
  • 2

1 Answers1

0

You can use either one of these locators. Here we're just looking for the substring, ", not seen" in the aria-label attribute.

button[aria-label*=', not seen'] # By.CSS_SELECTOR
//button[contains(@aria-label, ', not seen')] # By.XPATH
JeffC
  • 22,180
  • 5
  • 32
  • 55