I try to click on the more element on these pages - with the following code
for the following link this works fine with finding element per xpath:
import os, sys, time
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from sys import platform
WAIT = 1
link = "https://apps.apple.com/us/app/daily-budget-original/id651896614?uo=4"
path = os.path.abspath (os.path.dirname (sys.argv[0]))
if platform == "win32": cd = '/chromedriver.exe'
elif platform == "linux": cd = '/chromedriver'
elif platform == "darwin": cd = '/chromedriver'
options = Options()
options.add_argument("--window-size=1920x1080")
options.add_argument('--no-sandbox')
options.add_argument('--disable-gpu')
options.add_experimental_option ('excludeSwitches', ['enable-logging'])
# options.add_argument('--headless')
driver = webdriver.Chrome (path + cd, options=options)
driver.get (link) # Read link
time.sleep (WAIT) # Wait till the full site is loaded
driver.find_element_by_xpath('//*[@id="ember-app"]/div/main/div[2]/section[7]/div[1]/dl/div[9]/dd/ol/div/button').click()
But when i try the same code with another link / app like https://apps.apple.com/us/app/contacts-backup-pro-restore/id1120943403?uo=4 the more-element is not opening anymore
I saw that the xpath is slightly different so i tried it with
driver.find_element_by_xpath('//*[@id="ember-app"]/div/main/div[2]/section[9]/div[1]/dl/div[9]/dd/ol/div/button').click()
but this isn´t working
then i tried it with class-selector instead with
driver.findElement(By.cssSelector("button[class='we-truncate__button we-truncate__button--top-offset link']")).click()
but this isn´t working for both links now...
Is there anyway to get both links running - in the best case with css-selectors?