Skip to main content
formatting
Source Link
Bharat Mane
  • 6.8k
  • 11
  • 41
  • 69

itIt is not working because Button "Log Out" needs some loading time to be shown in website.
soSo use this it will definitely work for all  . Sleeping time should be given to load text inside that button after clicking the button and before clicking on log out

fromFrom selenium import webdriver 
import time

User_Name = input(">") Pass_Word = input(">") if len(User_Name) > 1 and len(Pass_Word) > 1: browser = webdriver.Chrome() browser.get("https://facebook.com") sign_in = browser.find_element_by_link_text("Log In") sign_in.click() username = browser.find_element_by_id("email") username.send_keys(User_Name) password = browser.find_element_by_id("pass") password.send_keys(Pass_Word) password.submit() button = browser.find_element_by_id("userNavigationLabel") button.click() time.sleep(20) l_og = browser.find_element_by_link_text("Log Out") l_og.click() browser.close() else: raise KeyError

User_Name = input(">")
Pass_Word = input(">")
if len(User_Name) > 1 and len(Pass_Word) > 1:
    browser = webdriver.Chrome()
    browser.get("https://facebook.com")
    sign_in = browser.find_element_by_link_text("Log In")
    sign_in.click()
    username = browser.find_element_by_id("email")
    username.send_keys(User_Name)
    password = browser.find_element_by_id("pass")
    password.send_keys(Pass_Word)
    password.submit()
    button = browser.find_element_by_id("userNavigationLabel")
    button.click()
    time.sleep(20)
    l_og = browser.find_element_by_link_text("Log Out")
    l_og.click()
    browser.close()
else:
    raise KeyError

it is not working because Button "Log Out" needs some loading time to be shown in website so use this it will definitely work for all  . Sleeping time should be given to load text inside that button after clicking the button and before clicking on log out

from selenium import webdriver import time

User_Name = input(">") Pass_Word = input(">") if len(User_Name) > 1 and len(Pass_Word) > 1: browser = webdriver.Chrome() browser.get("https://facebook.com") sign_in = browser.find_element_by_link_text("Log In") sign_in.click() username = browser.find_element_by_id("email") username.send_keys(User_Name) password = browser.find_element_by_id("pass") password.send_keys(Pass_Word) password.submit() button = browser.find_element_by_id("userNavigationLabel") button.click() time.sleep(20) l_og = browser.find_element_by_link_text("Log Out") l_og.click() browser.close() else: raise KeyError

It is not working because Button "Log Out" needs some loading time to be shown in website.
So use this it will definitely work for all. Sleeping time should be given to load text inside that button after clicking the button and before clicking on log out

From selenium import webdriver 
import time:

User_Name = input(">")
Pass_Word = input(">")
if len(User_Name) > 1 and len(Pass_Word) > 1:
    browser = webdriver.Chrome()
    browser.get("https://facebook.com")
    sign_in = browser.find_element_by_link_text("Log In")
    sign_in.click()
    username = browser.find_element_by_id("email")
    username.send_keys(User_Name)
    password = browser.find_element_by_id("pass")
    password.send_keys(Pass_Word)
    password.submit()
    button = browser.find_element_by_id("userNavigationLabel")
    button.click()
    time.sleep(20)
    l_og = browser.find_element_by_link_text("Log Out")
    l_og.click()
    browser.close()
else:
    raise KeyError
Source Link

it is not working because Button "Log Out" needs some loading time to be shown in website so use this it will definitely work for all . Sleeping time should be given to load text inside that button after clicking the button and before clicking on log out

from selenium import webdriver import time

User_Name = input(">") Pass_Word = input(">") if len(User_Name) > 1 and len(Pass_Word) > 1: browser = webdriver.Chrome() browser.get("https://facebook.com") sign_in = browser.find_element_by_link_text("Log In") sign_in.click() username = browser.find_element_by_id("email") username.send_keys(User_Name) password = browser.find_element_by_id("pass") password.send_keys(Pass_Word) password.submit() button = browser.find_element_by_id("userNavigationLabel") button.click() time.sleep(20) l_og = browser.find_element_by_link_text("Log Out") l_og.click() browser.close() else: raise KeyError