1

I tried to write code to login using pywinauto and selenium, but my script is getting failed. I tried to find solution, but it seems there is no much info available on this.

from pywinauto import application
from selenium import webdriver

driver=webdriver.Chrome()
app=application.Application()
driver.get("https://google.co.in")//url for google only as an example 
app = application.Application()
app.connect(backend="uia") // getting issue in this line, what to write under bracket to connect to opened browser?
app.window_().TypeKeys('username') // Is this proper way to type text in authentication window username field where cursor blinks by default?

I am getting below error message

pywinauto.findwindows.ElementAmbiguousError: There are 6 elements that match the criteria {'backend': u'win32'}

Note : For login to my application, windows authentication popup appears which cannot be handled in selenium, so need to handle it using other tool. I had a solution to it earlier which is not working now, I had asked it here Windows authentication code no longer working now

Shoaib Akhtar
  • 1,393
  • 5
  • 17
  • 46
  • Why use pywinauto when selenium does button clicks and typing functions. – JohnPaul Apr 05 '18 at 15:09
  • 1
    For login to my application, windows authentication popup appears which cannot be handled in selenium, so need to handle it using other tool. I had a solution to it earlier which is not working now, I had asked it here https://stackoverflow.com/questions/49491048/windows-authentication-code-no-longer-working-now?noredirect=1#comment86235945_49491048 – Shoaib Akhtar Apr 05 '18 at 15:13
  • Does `app = application.Application(backend="uia").connect(path="chrome.exe")` work? – Jacques Gaudin Apr 05 '18 at 15:14

1 Answers1

0

The steps your need are; open the page, find the elements you want to interact with (such as login text box) then type your input. This can all be done in selenium. Check out the documentation: http://selenium-python.readthedocs.io/navigating.html#interacting-with-the-page

JohnPaul
  • 294
  • 1
  • 4
  • 13
  • 2
    For login to my application, windows authentication popup appears which cannot be handled in selenium, so need to handle it using other tool. I had a solution to it earlier which is not working now, I had asked it here https://stackoverflow.com/questions/49491048/windows-authentication-code-no-longer-working-now?noredirect=1#comment86235945_49491048 – Shoaib Akhtar Apr 05 '18 at 15:16
  • No, need to search. It would be better if you provide any link to it which works for me – Shoaib Akhtar Apr 05 '18 at 15:20