how to c# ranorex Selenium web integration

Ask general questions here.
Mertcan
Posts: 2
Joined: Fri Oct 04, 2019 9:50 am

how to c# ranorex Selenium web integration

Post by Mertcan » Fri Oct 04, 2019 10:25 am

Using library

using System;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.Drawing;
using System.Threading;
using WinForms = System.Windows.Forms;
using Ranorex;
using Ranorex.Core;
using Ranorex.Core.Testing;
using OpenQA.Selenium;
using OpenQA.Selenium.Firefox;


IWebDriver driver = new FirefoxDriver();
string link = @"https://www.n11.com/";

driver.Navigate().GoToUrl(link);

driver.FindElement(By.ClassName("btnSignIn")).Click();

this code gives error in ranorex studio running .net


errors

The type 'OpenQA.Selenium.IWebDriver' is in both 'c: \ Program Files (x86) \ Ranorex \ Studio \ Bin \ Ranorex.Plugin.WebDriver.dll' and 'c: \ Users \ berka \ Documents \ Ranorex \ RanorexStudio Projects exists in \ selenium \ packages \ Selenium.WebDriver.3.141.0 \ lib \ net45 \ WebDriver.dll (CS0433) - C: \ Users \ berka \ Documents \ Ranorex \ RanorexStudio Projects \ selenium \ selenium \ Login.cs: 51 4



The 'OpenQA.Selenium.Firefox.FirefoxDriver' type cannot be implicitly converted to the 'OpenQA.Selenium.IWebDriver' type. Open conversion exists (missing assignment?) (CS0266) - C: \ Users \ berka \ Documents \ Ranorex \ RanorexStudio Projects \ selenium \ selenium \ Login.cs: 51.24


The type 'OpenQA.Selenium.By' is available in both 'c: \ Program Files (x86) \ Ranorex \ Studio \ Bin \ Ranorex.Plugin.WebDriver.dll' and 'c: \ Users \ berka \ Documents \ Ranorex \ RanorexStudio Projects exists in \ selenium \ packages \ Selenium.WebDriver.3.141.0 \ lib \ net45 \ WebDriver.dll (CS0433) - C: \ Users \ berka \ Documents \ Ranorex \ RanorexStudio Projects \ selenium \ selenium \ Login.cs: 56 32

vancrideout
Posts: 1
Joined: Tue Jul 07, 2020 8:06 am
Location: 3378 Fairway Drive Vacaville
Contact:

Re

Post by vancrideout » Tue Jul 07, 2020 8:15 am

I even have an issue. I'm the use of VS code + .Net Test Explorer, as you. When i Run my tests with "Assert.Fail();" most effective for take a look at, such as you did, This Tests disappear from .Net take a look at Explorer. I can't understand what is going on... I've already tried to configurate the "Test Project Path", but not anything changes. but I actually have one question, What the difference to apply a Ranorex to do a automation for my website than a Selenium WebDriver ? Basicly I'll have the same result right?

User avatar
Vega
Certified Professional
Certified Professional
Posts: 222
Joined: Mon Jul 11, 2016 2:15 pm

Re: how to c# ranorex Selenium web integration

Post by Vega » Wed Jul 08, 2020 5:49 pm

Ranorex already includes the needed packages to interact with Selenium, you do not need to add them to your project. Based on the errors provided, I would guess that you added Selenium packages via the package manager which is causing your ambiguity between references. If you removed the packages you added and just add the using statements your issue should go away.

There is a sample Ranorex Selenium C# project available here (was released with Ranorex 7.1.0:
Ranorex WebDriver Integration API has been extended to allow access to the underlying driver implementation. A sample solution is available for download.
The above comes from the Ranorex Release notes for 7.1.0; here is the download link:

http://download.ranorex.com/public/7.1/wda01.zip

Hope this helps!