Launch Chrome Incognito in LeanFT
Question ID:
109421
♥ 0 |
I’m using LeanFT (UFT Developer) and doing tests using Chrome. One of my test cases requires Chrome to be in Incognito mode. I can’t seem to figure out how to launch Chrome Incognito from LeanFT.
Marked as spam
|
Answers (1)
Private answer
I found a way to do this. Basically you need to configure the LeanFT Extension to allow Incognito mode. Then in your code, launch Chrome as usual and perform DeviceReplay steps to open an Incognito browser. Close the original browser, and attach the new incognito browser.
var browser = BrowserFactory.Launch(BrowserType.Chrome); Keyboard.KeyDown(157); //hold down Control key Keyboard.KeyDown(42); //hold down Shift key Keyboard.PressKey(49); //press N Keyboard.KeyUp(157); //release Control key Keyboard.KeyUp(42); //release Shift key browser.Close(); //Close original browser //Attach new incongnito browser var IncogChrome = BrowserFactory.Attach(new BrowserDescription { Title = "New Tab" }); //Do test stuff IncogChrome.Navigate("http://google.com"); var search = IncogChrome.Describe<IEditField>(new EditFieldDescription { Name = @"q" }); search.SetValue("Orasi Software"); var googleSearchButton = IncogChrome.Describe<IButton>(new ButtonDescription { AccessibilityName = @"Google Search", ButtonType = @"submit", Name = @"Google Search", Role = string.Empty, TagName = @"INPUT", Index = 1 }); googleSearchButton.Click(); var link = IncogChrome.Describe<ILink>(new LinkDescription { InnerText = @"Home - Orasi Software Incorporatedhttps://www.orasi.com", TagName = @"A" }); link.Click(); IncogChrome.Close(); Marked as spam
|