sdaly wrote:...add a reference to Ranorex, then add "Using Ranorex;", you can use both Ranorex and Selenium from the same project, fixture, test, whatever!
Excellent, works like a charm

I'm confident with Selenium but not with Ranorex, and initially I was trying to add my Selenium steps into a recorded/outputted code of Ranorex... and basically it was messing with my head!!
sdaly wrote:Not sure why you would want to use both Selenium and Ranorex though, why not just use Ranorex for both web and app testing?
Yeah I knew someone would ask me this

I want to continue to use Selenium because the Web Client project already has many Selenium scripts and I want to utilise all previous work done.
Here is my code for future reference:
Code: Select all
using System;
using System.Threading;
using Selenium;
using NUnit.Framework;
using Ranorex;
using findEuro;
namespace GtsAutomation.TestScripts.Template
{
[TestFixture]
public class SeleniumRanorex
{
private ISelenium selenium;
private string now;
[SetUp]
public void SetupTest()
{
now = System.DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss");
selenium = new DefaultSelenium(Config.Host, 4444, Config.Browser, Config.Url);
selenium.Start();
selenium.SetSpeed(Config.SetSpeed);
selenium.WindowMaximize();
}
[TearDown]
public void TeardownTest()
{
selenium.Stop();
}
// Ranorex
public static findEuroRepository repo = findEuroRepository.Instance;
[Test]
public void StockAdjustmentActionLog0215()
{
// Open site URL
selenium.Open(Config.Url);
// select Stock and Adjustment
selenium.ClickAndWait(Menu.Stock);
// etc
// instigate Ranorex
Mouse.DefaultMoveTime = 300;
Keyboard.DefaultKeyPressTime = 100;
Delay.SpeedFactor = 1.0;
//Init();
Report.Log(ReportLevel.Info, "Application", "Run application 'C:\\Application For Test\\Application.exe' with arguments '' in normal mode.", new RecordItemIndex(0));
Host.Local.RunApplication("C:\\Application For Test\\Application.exe", "", "", false);
Delay.Milliseconds(0);
Validate.Exists(repo.FormLogOn___Global_Trading_S.TextLoginInfo);
Report.Log(ReportLevel.Info, "Mouse", "Mouse Left Click item 'FormLogOn___Global_Trading_S.TextLogin' at 6;10.", repo.FormLogOn___Global_Trading_S.TextLoginInfo, new RecordItemIndex(1));
repo.FormLogOn___Global_Trading_S.TextLogin.Click("6;10");
Delay.Milliseconds(0);
Validate.Exists(repo.FormHome___Global_Trading_Sy.ElementConnectionStatusPopupInfo);
Report.Log(ReportLevel.Info, "Mouse", "Mouse Left Click item 'FormHome___Global_Trading_Sy.ElementConnectionStatusPopup' at 1893;13.", repo.FormHome___Global_Trading_Sy.ElementConnectionStatusPopupInfo, new RecordItemIndex(17));
repo.FormHome___Global_Trading_Sy.ElementConnectionStatusPopup.Click("1893;13");
Delay.Milliseconds(0);
Validate.Exists(repo.FormGlobal_Trading_System.ButtonYesInfo);
Report.Log(ReportLevel.Info, "Mouse", "Mouse Left Click item 'FormGlobal_Trading_System.ButtonYes' at 26;10.", repo.FormGlobal_Trading_System.ButtonYesInfo, new RecordItemIndex(18));
repo.FormGlobal_Trading_System.ButtonYes.Click("26;10");
Delay.Milliseconds(0);
}
}
}
Thank you all...
