Quantcast
Channel: Silk Test - Forum - Recent Threads
Viewing all articles
Browse latest Browse all 625

Need help with writing an If/Then style bit of code to handle if a security challenge appears in a new window, and if not, proceeds with rest of script.

$
0
0

Hey there,

Here is my situation with the error "'Browser' is not declared. It may be inaccessible due to its protection level" I am getting:

  • Website has a login that has an option to 'remember this computer'
  • When that aforementioned option is not selected, anytime you login with this userId, you will be met with a page that requests you to answer a security question to proceed
  • As this script could be run on a variety of desktops, some might clear caches, some might not, so we need a way:
  • To check if the 'Confirm your Identity' page has displayed
  • If so, negotiate the security answer
  • If not, then proceed with the rest of the script as if it never popped up

I dug around the internet and saw nothing about best practices using this method.  Script is very simple (line in bold italics is the problemline):

Imports System.Diagnostics
Imports SilkTest.Ntf.XBrowser
Imports System.IO

Public Module Main

Public _desktop As Desktop = Agent.Desktop,
applicationProcess As New Process(),
ieprocess As New Process(),
chromeprocess As New Process(),
psi As New ProcessStartInfo()

Public Sub Main

With _desktop.BrowserApplication()
.SetActive()
.Maximize()
With .BrowserWindow("@url='*website.com*'")

Call Exists()

End Sub

Public Sub Exists()

With _desktop.BrowserApplication()

With .BrowserWindow("@url='*website.com*'")

<steps here>

BrowserWindow.WaitForObject("//BrowserWindow[@url='https://website.com/clientportal/j_security_check']", 10000)

.DomTextField("//input[@name='securityAnswer1']").SetText("securityanswer")

.DomButton("//input[@id='continue']").DomClick

End Sub

So what do you think woul dbe the best way to handle this?


Viewing all articles
Browse latest Browse all 625

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>