Sep-11-2020, 10:58 AM
Sep-11-2020, 11:13 AM
hi i made script with selenium for auto login but i want to get data from .txt file . format is user:pass or mail:pass
also i did this for get data
from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.support.wait import WebDriverWait import time browser = webdriver.Chrome() browser.get("site") browser.find_element_by_id("login-username").send_keys(email) browser.find_element_by_id("login-password").send_keys(pass) browser.find_element_by_id("login-button").click() time.sleep(5) browser.find_element_by_css_selector("._95e9f2bdfb-scss > button:nth-child(1)").click()
also i did this for get data
filepath = "combofile" combo = open(filepath,"r") line = list(filepath) for line in combo : temp = line.strip().split(":") or both email = temp[0] password = temp[1]but didnt work, with this method using all emails/passwords in one request
Sep-11-2020, 11:43 AM
Hello R3born
Please use the login code inside the for loop
Hence, your final code should look like this.
Please use the login code inside the for loop
Hence, your final code should look like this.
browser.get("site") filepath = "combofile" combo = open(filepath,"r") line = list(filepath) for line in combo : temp = line.strip().split(":") or both email = temp[0] pass = temp[1] browser.find_element_by_id("login-username").send_keys(email) browser.find_element_by_id("login-password").send_keys(pass) browser.find_element_by_id("login-button").click() time.sleep(5) browser.find_element_by_css_selector("._95e9f2bdfb-scss > button:nth-child(1)").click()
Sep-11-2020, 07:06 PM
(Sep-11-2020, 11:43 AM)wintenrod Wrote: [ -> ]Hello R3born
Please use the login code inside the for loop
Hence, your final code should look like this.browser.get("site") filepath = "combofile" combo = open(filepath,"r") line = list(filepath) for line in combo : temp = line.strip().split(":") or both email = temp[0] pass = temp[1] browser.find_element_by_id("login-username").send_keys(email) browser.find_element_by_id("login-password").send_keys(pass) browser.find_element_by_id("login-button").click() time.sleep(5) browser.find_element_by_css_selector("._95e9f2bdfb-scss > button:nth-child(1)").click()
thanks!
my last question is how can i open new tab with new user:pass data?