Guest User

Untitled

a guest
May 17th, 2018
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. from selenium import webdriver
  2. driver = webdriver.Chrome('C:SeleniumDriverschromedriver.exe')
  3. userName = 'null'
  4. driver.get('https://talkwithstranger.com/talk-to-strangers')
  5.  
  6. while 'female' not in userName or 'Female' not in userName:
  7. driver.get('https://talkwithstranger.com/talk-to-strangers')
  8. html = driver.execute_script("return document.documentElement.innerHTML;")
  9.  
  10. from bs4 import BeautifulSoup
  11. soup = BeautifulSoup(html, 'html5lib')
  12. userVal = soup.find(class_='alert text-center alert-success')
  13. userNames = userVal.find_all('b')
  14.  
  15. def getName(userNames):
  16. for name in userNames:
  17. return name.prettify()
  18.  
  19. userName = getName(userNames)
Add Comment
Please, Sign In to add comment