radio fixed

This commit is contained in:
feder-cr 2024-08-22 19:33:25 +01:00
parent 660bb63f04
commit 668135d669
2 changed files with 9 additions and 6 deletions

View file

@ -215,7 +215,8 @@ class LinkedInEasyApplier:
return False
def _find_and_handle_radio_question(self, section: WebElement) -> bool:
radios = section.find_elements(By.CLASS_NAME, 'fb-text-selectable__option')
question = section.find_element(By.CLASS_NAME, 'jobs-easy-apply-form-element')
radios = question.find_elements(By.CLASS_NAME, 'fb-text-selectable__option')
if radios:
question_text = section.text.lower()
options = [radio.text.lower() for radio in radios]
@ -224,6 +225,7 @@ class LinkedInEasyApplier:
return True
return False
def _find_and_handle_textbox_question(self, section: WebElement) -> bool:
text_fields = section.find_elements(By.TAG_NAME, 'input') + section.find_elements(By.TAG_NAME, 'textarea')
if text_fields:
@ -271,9 +273,10 @@ class LinkedInEasyApplier:
def _select_radio(self, radios: List[WebElement], answer: str) -> None:
for radio in radios:
if radio.text.lower() == answer.lower():
radio.click()
break
if answer in radio.text.lower():
radio.find_element(By.TAG_NAME, 'label').click()
return
radios[-1].find_element(By.TAG_NAME, 'label').click()
def _select_dropdown_option(self, element: WebElement, text: str) -> None:
select = Select(element)