Reputation: 19
So I'm trying to make a Messenger bot using Selenium and Python. I don't have any code errors my code works just fine, the problem is that after it's done it just kills the WebDriver. Here's my code:
from selenium import webdriverlogin_email = "" #Your facebook email login_password = "" #Your facebook password
def login_pulamea():
driver = webdriver.Chrome() driver.get("http://messenger.com") #Waits for page to load driver.implicitly_wait(10) # Inputing email email_box = driver.find_element_by_xpath("""//*[@id="email"]""") email_box.clear() email_box.send_keys(login_email) # Inputing password password_box = driver.find_element_by_xpath("""//*[@id="pass"]""") password_box.clear() password_box.send_keys(login_password) #Submit details submit_button = driver.find_element_by_xpath("""//*[@id="loginbutton"]""") submit_button.click() login_pulamea()
Upvotes: 0
Views: 3241
Reputation: 25531
Put a breakpoint on the last line of code you want executed before it stops and then run it in debug mode (this will vary depending on your IDE). Once it pauses, you can kill the run and take over the browser or whatever else you want to do.
Upvotes: 0
Reputation: 1877
I have not tried it but I think here is what you could do and I believe this would only work with firefox but that should not be a problem for you as you are not testing any specific browser
PersistentWebdriver
class.An extra note is latest selenium driver works well with Firefox 45. It has know crash issues with Firefox 47 so make sure you stick to version 45.
Upvotes: 1