I tried the below code, but it didn't work for me
from selenium import webdriver
driver=webdriver.Chrome('D:/BrowsersDriver/chromedriver.exe')
driver.get('https://username:[email protected]/')
Later on I tried to use the same approach in Java
driver.get('https://username:[email protected]/')
But unfortunately it didn't work for me in any browser. Am I missing something here?
Then I tried with AutoIT in Java
Runtime.getRuntime().exec("D:\\FirefoxWindowAuthentication.exe");
driver.get("https://www.engprod-charter.net/")
It works well in Firefox & IE, but didn't work for Chrome. Is there any way that at-least I can achieve this in selenium using python & what I am missing in case of Java. Please suggest me any solution, tried a lot
I got this solution which is working well for all three browser(Firefox, Chrome and IE).
from selenium import webdriver
import time
import win32com.client
driver=webdriver.Firefox()
driver.maximize_window()
driver.get('https://www.engprod-charter.net/')
shell = win32com.client.Dispatch("WScript.Shell")
shell.Sendkeys("username")
time.sleep(2)
shell.Sendkeys("{TAB}")
time.sleep(2)
shell.Sendkeys("password")
time.sleep(2)
shell.Sendkeys("{ENTER}")
time.sleep(2)
driver.quit()
Note : Install win32com.client if you have not downloaded. To install win32com.client use below command
pip install pypiwin32
Try following solution and let me know in case of any issues:
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
driver=webdriver.Firefox()
driver.get('https://www.engprod-charter.net/')
time.sleep(3)
driver.switch_to.alert.send_keys(username + Keys.TAB + password)
time.sleep(3)
driver.switch_to.alert.accept()
Here is the solution for IE on Windows using third-party autoHK lib
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With