josette_merhy12
11 years agoOccasional Contributor
Switching Browsers
hi, i m trying to run the same jscript function on firefox and chrome.
i m setting the variable browser = Sys.Browser()
the first time i call this function, chrome was opened, so the system browser is chrome.
after i close chrome, i open firefox, but the Sys.Browser is still chrome.
how can i test the same jscript function using diffrent browsers.
steps i follow:
1-open chrome
2-set the variable in script browser = Sys.Browser() and do actions on browser.
3-close chrome
4-open FireFox
5-set the variable in script browser = Sys.Browser() and do actions on browser. but the browser is still Chrome.
i m setting the variable browser = Sys.Browser()
the first time i call this function, chrome was opened, so the system browser is chrome.
after i close chrome, i open firefox, but the Sys.Browser is still chrome.
how can i test the same jscript function using diffrent browsers.
steps i follow:
1-open chrome
2-set the variable in script browser = Sys.Browser() and do actions on browser.
3-close chrome
4-open FireFox
5-set the variable in script browser = Sys.Browser() and do actions on browser. but the browser is still Chrome.
- Instead of Sys.Browser() use Sys.Browser("nameOfYourBrowser").
What I do is, I have a project variable browser and whenever I need to change browsers I do:
function setBrowser(browser)
{
Project.Variables.browser = browser
}
function useDiffentBrowsers()
{
setBrowser("firefox")
Sys.Browser(Project.Variables.browser).Page.Find(something).Click()
setBrowser("chrome")
Sys.Browser(Project.Variables.browser).Page.Find(something).Click()
}