Merge pull request #135 from spectreDeveloper/v3

logged in functions optimized
This commit is contained in:
Federico 2024-08-29 17:31:56 +02:00 committed by GitHub
commit 45bc6ea95d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -65,18 +65,8 @@ class LinkedInAuthenticator:
print("Security check not completed. Please try again later.")
def is_logged_in(self):
self.driver.get('https://www.linkedin.com/feed')
try:
WebDriverWait(self.driver, 10).until(
EC.presence_of_element_located((By.CLASS_NAME, 'share-box-feed-entry__trigger'))
)
buttons = self.driver.find_elements(By.CLASS_NAME, 'share-box-feed-entry__trigger')
if any(button.text.strip() == 'Start a post' for button in buttons):
print("User is already logged in.")
return True
except TimeoutException:
pass
return False
self.driver.get('https://www.linkedin.com/')
return self.driver.current_url == 'https://www.linkedin.com/feed/'
def wait_for_page_load(self, timeout=10):
try: