Merge pull request #135 from spectreDeveloper/v3
logged in functions optimized
This commit is contained in:
commit
45bc6ea95d
@ -65,18 +65,8 @@ class LinkedInAuthenticator:
|
|||||||
print("Security check not completed. Please try again later.")
|
print("Security check not completed. Please try again later.")
|
||||||
|
|
||||||
def is_logged_in(self):
|
def is_logged_in(self):
|
||||||
self.driver.get('https://www.linkedin.com/feed')
|
self.driver.get('https://www.linkedin.com/')
|
||||||
try:
|
return self.driver.current_url == 'https://www.linkedin.com/feed/'
|
||||||
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
|
|
||||||
|
|
||||||
def wait_for_page_load(self, timeout=10):
|
def wait_for_page_load(self, timeout=10):
|
||||||
try:
|
try:
|
||||||
|
Loading…
Reference in New Issue
Block a user