0

I want to execute the following script in C# using selenium

Script

$("btn-standard buyButton currency-coins").on('click',function () {
  $(".dialog-body .ut-button-group .btn-text").click();})

C# code

IWebDriver driver;
driver = new FireFoxdriver()
IJavaScriptExecutor js = driver as IJavaScriptExecutor;

//here I want to integrate the script
js.ExecuteScript(.....)
driver.FindElement(By.XPath("//button[text()[contains(.,'Buy Now')]]")).Click(); //this button has btn-standard buyButton currency-coins class 

How can I integrate the script?

Viorel
  • 39
  • 5

1 Answers1

0

Try to execute javascript in Selenium C# like that :

string commandJs = "return document.readyState"; ((IJavaScriptExecutor)driver).ExecuteScript(commandJs);