Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23131

I cannot get selenium to click on these input radios to save my life on the. Im trying to created an automatic job app applyer in linkedIn

$
0
0
def job_filtering(self):    try:        print("Clicking on Time Posted filter...")        # Click on the "Time Posted" filter        time_filter = WebDriverWait(self.driver, 20).until(            EC.element_to_be_clickable(                (By.CSS_SELECTOR, '#searchFilter_timePostedRange, #searchFilter_timePostedRange-trigger')))        time_filter.click()        # Locate the "Past Week" option using a relative XPath expression        past_week_option = WebDriverWait(self.driver, 20).until(            EC.element_to_be_clickable((By.ID, 'timePostedRange-r604800')) or            EC.element_to_be_clickable((By.ID, 'timePostedRange-trigger')) or            EC.element_to_be_clickable(('value', 'r604800')) or            EC.element_to_be_clickable((By.XPATH, '//*[@id="timePostedRange-r604800"]')) and            self.driver.find_element('type', 'radio')        )        past_week_option.click()        sumbition_filter = WebDriverWait(self.driver, 20).until(            EC.element_to_be_clickable((By.XPATH, '//*[@id="ember1266"]'))        )        sumbition_filter.click()        print("Selected 'Past Week' option successfully.")    except TimeoutException:        print("Timeout occurred while waiting for time posted filter.")    except Exception as e:        print("Error interacting with the time posted filter:", e)    try:        print("Clicking on Experience Level filter...")        exp_filter = WebDriverWait(self.driver, 20).until(            EC.element_to_be_clickable((By.ID, 'searchFilter_experience')))        exp_filter.click()        for exp_level in ['Internship', 'Entry level', 'Associate']:            exp_option = WebDriverWait(self.driver, 20).until(                EC.element_to_be_clickable((By.XPATH, f'//label[contains(text(), "{exp_level}")]')))            exp_option.click()            print(f"Selected {exp_level} option successfully.")    except TimeoutException:        print("Timeout occurred while waiting for experience level filter.")    except Exception as e:        print("Error interacting with the experience level filter:", e)

I was trying to click on the radio inputs under the Date Posted tab and the experience level on linked in. But for some reason I cannot get selenium to click on the buttons. I have when to every selector possible and used both xpath and full xpath to try and select them but it does not work


Viewing all articles
Browse latest Browse all 23131

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>