Locating element on reddit page

25 views
Skip to first unread message

Rick M

unread,
Jun 14, 2024, 8:34:38 AM (12 days ago) Jun 14
to Selenium Users
Hi, using url:

I'm trying to locate the upload button element as shown in the attached image.

its code:
<button rpl="" class="upload-media action button-small px-[var(--rem6)] button-secondary icon items-center justify-center button inline-flex " id="device-upload-button" type="button"> <!--?lit$869276182$--><!----><span class="flex items-center justify-center"> <!--?lit$869276182$--><span class="flex"><!--?lit$869276182$--><svg rpl="" fill="currentColor" height="16" icon-name="upload-outline" viewBox="0 0 20 20" width="16" xmlns="http://www.w3.org/2000/svg"> <!--?lit$869276182$--><!--?lit$869276182$--><path d="m10.513 5.63 3.929 3.928-.884.884-2.933-2.933V19h-1.25V7.51l-2.933 2.932-.884-.884L9.67 5.446l.589-.029.254.212Zm5.859-1.482A6.876 6.876 0 0 0 10 0a6.876 6.876 0 0 0-6.372 4.148A4.639 4.639 0 0 0 0 8.625a4.716 4.716 0 0 0 4.792 4.625V12A3.465 3.465 0 0 1 1.25 8.625 3.412 3.412 0 0 1 4.189 5.31l.364-.06.123-.35A5.607 5.607 0 0 1 10 1.25a5.607 5.607 0 0 1 5.324 3.65l.123.348.364.06a3.412 3.412 0 0 1 2.939 3.317A3.465 3.465 0 0 1 15.208 12v1.25A4.716 4.716 0 0 0 20 8.625a4.639 4.639 0 0 0-3.628-4.477Z"></path><!--?--> </svg></span> <!--?lit$869276182$--> </span> <!--?lit$869276182$--><!--?--><!----><!----><faceplate-screen-reader-content><!--?lit$869276182$-->Upload files</faceplate-screen-reader-content><!----> </button>

I tried the following but it didn't work:

driver = webdriver.Firefox() driver.get("https://www.reddit.com/r/Watchexchange/submit/?type=IMAGE") wait = WebDriverWait(driver, 10) wait.until(EC.presence_of_element_located((By.ID, 'device-upload-button'))) wait.until(EC.presence_of_element_located((By.XPATH, '//*[@id="device-upload-button"]'))) wait.until(EC.presence_of_element_located((By.XPATH,'//button[contains(@class,'flex items-center justify-center')])))

I think the element might be in a frame but I'm not sure how to locate it. How can I locate this element?

reddit.PNG

Sagar S (Vishal)

unread,
Jun 21, 2024, 10:55:31 AM (5 days ago) Jun 21
to Selenium Users
Hi,
I can help you with this ! You can setup googlemeet 

My website - www.softpost.org 
Reply all
Reply to author
Forward
0 new messages