简体   繁体   中英

How to open a website with Firefox and set authentication in a Coded UI Test?

I want to make a Coded UI Test with VS2015, which opens a website - using the Firefox browser. Unfortunately when the website opens, an authenitication-popup appears and the labels (like "Username:") as well as the entryfields have the same name. So when i playback my recording, Coded UI always tries to set the text of the label instead of the textbox.

Is there a possibility - per example with BrowserWindow.Launch or something like that - to launch the website and set the authentication in one line of code?

Best regards, Patrick

Looking at the popup with the crosshairs tool of Coded UI may show some differences between the label and the textbox, differences that can be added to the SearchProperties used to find the control.

If that does not work them consider using the GetChildren or FindMatchingControls methods on (some control within) the popup. Expect them to return both the label and the textbox. They may return other unwanted controls as well. Then you can write your own code to distinguish the two controls. If nothing else is available you may find comparing the Left and/or Top and/or BoundingRectangle properties shows the relative positions or sizes of the two items on the popup.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM