0

Im creating c# Selenim Webdriver application

when i traying call javascript function on c# ,executeScript return null or "" value.

How can i wait until called functions inside ajax is done

Sorry for my english

 IJavaScriptExecutor js = (IJavaScriptExecutor)driver;
 String Myresponse = (String)js.ExecuteScript("return getUrl(" + MyUrL+ ");");
 richTextBox1.Text = Myresponse; 

in Javascript file my function

function getUrl(gUrl){
    $.ajax({
    type: 'GET',
    url: gUrl, 
    }).done(function(d) {
        return "Success";

    }).fail(function(a) {
       return "Fail";
    }); 

 }
Mahmut Duman
  • 407
  • 1
  • 5
  • 12
  • @DebanjanB Your links not my answer ,Please re check my question. – Mahmut Duman Mar 15 '20 at 21:38
  • @DebanjanB I want detect javascript function was finished not check document readystate change . im waiting is this ajax finished, i was solved other way (create element and set value to ajax answer and read this element value from c#) bu not clean for me. function getUrl(gUrl){ $.ajax({ type: 'GET', url: gUrl, }).done(function(d) { return "Success"; }).fail(function(a) { return "Fail"; }); } – Mahmut Duman Mar 15 '20 at 21:47

0 Answers0