aminblm / linkedin-application-bot

A python bot to apply all Linkedin Easy Apply jobs based on your preferences.
https://www.linkedin.com/pulse/open-source-project-1-linkedin-application-bot-your-amin-sa8af/
Other
138 stars 58 forks source link

LinkedIn Automation Script Encounters Element Interaction Issues #24

Closed aminblm closed 10 months ago

aminblm commented 11 months ago

The provided log details an issue encountered while running a Python script (linkedin.py) that seems to automate some interactions with LinkedIn using the Selenium library. Here's a description of the issue based on the log:


Issue Description:

  1. Script Execution:

    • The script appears to start without any apparent issues, displaying a warning related to downloading.
    • It mentions that URLs are created successfully and that the bot will visit these URLs.
  2. Error Messages:

    • Multiple warnings and errors arise during the script's execution:
      • Warnings indicate the inability to locate specific elements on the LinkedIn page, such as job company details, posted dates, and job application counts.
      • An error states that an element (specifically a job application button) could not be scrolled into view.
      • The error stacktrace provides details pointing to the ElementNotInteractableException, suggesting the button or element in question couldn't be interacted with.
      • The script attempts to handle this exception but eventually fails, leading to the WebDriver process closing unexpectedly with status 0.
  3. Environment:

    • The script uses Selenium with Firefox as the browser driver.
    • The Python environment appears to be managed using Conda (as indicated by the path).
  4. Implications:

    • The script's main functionality seems to involve automating job applications on LinkedIn. However, due to the inability to interact with certain elements on the page, the script fails to complete its intended actions.
    • The unexpected closure of the WebDriver process indicates that the script terminates prematurely without completing its tasks.

Recommendations:

  1. Element Identification: Ensure that the script correctly identifies and interacts with elements on the LinkedIn page. If the structure or layout of LinkedIn pages has changed, it might affect the script's ability to locate and interact with specific elements.

  2. Error Handling: Enhance error handling within the script to better manage unexpected issues. This can prevent abrupt terminations and provide clearer feedback or logging for debugging.

  3. Environment Consistency: Ensure that all required dependencies, including the WebDriver executable (GeckoDriver in this case), are correctly installed and compatible with the script's Selenium version and browser.

  4. LinkedIn Automation Policies: Be cautious when automating interactions with platforms like LinkedIn, as they might have policies or mechanisms in place to detect and restrict bot-like activities.

Lastly, it's essential to review and potentially modify the script based on the current structure and behavior of LinkedIn's web pages to ensure consistent and reliable automation.

python linkedin.py
[WDM] - Downloading: 17.8kB [00:00, 7.14MB/s]
Urls are created successfully, now the bot will visit those urls.

 Category: chief technical officer, Location: European Economic Area, Applying 32 results jobs.
Warning in getting jobCompany: Message: Unable to locate element: //a[contains(@c
Warning in getting jobPostedDate: Message: Unable to locate element: //span[contains
Warning in getting jobApplications: Message: Unable to locate element: //span[contains
Error in main: Message: Element <button id="ember106" class="jobs-apply-button artdeco-button artdeco-button--3 artdeco-button--primary ember-view"> could not be scrolled into view
Stacktrace:
RemoteError@chrome://remote/content/shared/RemoteError.sys.mjs:8:8
WebDriverError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:183:5
ElementNotInteractableError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:293:5
webdriverClickElement@chrome://remote/content/marionette/interaction.sys.mjs:150:11
interaction.clickElement@chrome://remote/content/marionette/interaction.sys.mjs:119:11
clickElement@chrome://remote/content/marionette/actors/MarionetteCommandsChild.sys.mjs:214:29
receiveMessage@chrome://remote/content/marionette/actors/MarionetteCommandsChild.sys.mjs:97:31

---Took: 0 minute(s).
[WDM] - Downloading: 17.8kB [00:00, 13.3MB/s]
Traceback (most recent call last):
  File "/Users/macbook/repos/linkedin-application-bot/linkedin.py", line 241, in <module>
    Linkedin().linkJobApply()
  File "/Users/macbook/repos/linkedin-application-bot/linkedin.py", line 108, in linkJobApply
    button.click()
  File "/Users/macbook/opt/anaconda3/envs/py31/lib/python3.10/site-packages/selenium/webdriver/remote/webelement.py", line 93, in click
    self._execute(Command.CLICK_ELEMENT)
  File "/Users/macbook/opt/anaconda3/envs/py31/lib/python3.10/site-packages/selenium/webdriver/remote/webelement.py", line 410, in _execute
    return self._parent.execute(command, params)
  File "/Users/macbook/opt/anaconda3/envs/py31/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 444, in execute
    self.error_handler.check_response(response)
  File "/Users/macbook/opt/anaconda3/envs/py31/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py", line 249, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.ElementNotInteractableException: Message: Element <button id="ember106" class="jobs-apply-button artdeco-button artdeco-button--3 artdeco-button--primary ember-view"> could not be scrolled into view
Stacktrace:
RemoteError@chrome://remote/content/shared/RemoteError.sys.mjs:8:8
WebDriverError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:183:5
ElementNotInteractableError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:293:5
webdriverClickElement@chrome://remote/content/marionette/interaction.sys.mjs:150:11
interaction.clickElement@chrome://remote/content/marionette/interaction.sys.mjs:119:11
clickElement@chrome://remote/content/marionette/actors/MarionetteCommandsChild.sys.mjs:214:29
receiveMessage@chrome://remote/content/marionette/actors/MarionetteCommandsChild.sys.mjs:97:31

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/macbook/repos/linkedin-application-bot/linkedin.py", line 247, in <module>
    Linkedin().driver.quit()
  File "/Users/macbook/repos/linkedin-application-bot/linkedin.py", line 36, in __init__
    self.driver = webdriver.Firefox(options=utils.browserOptions(),service=Service(executable_path=GeckoDriverManager().install()))
  File "/Users/macbook/opt/anaconda3/envs/py31/lib/python3.10/site-packages/selenium/webdriver/firefox/webdriver.py", line 197, in __init__
    super().__init__(command_executor=executor, options=options, keep_alive=True)
  File "/Users/macbook/opt/anaconda3/envs/py31/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 288, in __init__
    self.start_session(capabilities, browser_profile)
  File "/Users/macbook/opt/anaconda3/envs/py31/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 381, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/Users/macbook/opt/anaconda3/envs/py31/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 444, in execute
    self.error_handler.check_response(response)
  File "/Users/macbook/opt/anaconda3/envs/py31/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py", line 249, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: Process unexpectedly closed with status 0