How to c# ranorex Selenium web integration

Ask general questions here.
sewabaru
Posts: 1
Joined: Sun Mar 08, 2020 8:15 am

How to c# ranorex Selenium web integration

Post by sewabaru » Sun Mar 08, 2020 8:21 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

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

Re: How to c# ranorex Selenium web integration

Post by Vega » Mon Mar 09, 2020 3:45 pm

Ranorex already has the Selenium reference included for use with webdriver endpoints; try removing the reference to Selenium that you added as it is a duplicate which is causing ambiguity.

If you create a brand new Ranorex solution, you will see that you can already work with some webdriver functions / types without added any packages or references manually:
forums69.png
forums69.png (15.53 KiB) Viewed 157 times
hope this helps