当前位置: 首页>>代码示例>>C#>>正文


C# WebControl.ExecuteJavascriptWithResult方法代码示例

本文整理汇总了C#中WebControl.ExecuteJavascriptWithResult方法的典型用法代码示例。如果您正苦于以下问题:C# WebControl.ExecuteJavascriptWithResult方法的具体用法?C# WebControl.ExecuteJavascriptWithResult怎么用?C# WebControl.ExecuteJavascriptWithResult使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WebControl的用法示例。


在下文中一共展示了WebControl.ExecuteJavascriptWithResult方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: copyAuctionCategories

        public static void copyAuctionCategories(WebControl wc)
        {
            string jsLib = getMyJavascript();
              try
              {
            //Создание таблицы categories, если таковой еще нет
            MySqlConnection con = new MySqlConnection(connectionString);
            string dbCommand = "CREATE TABLE IF NOT EXISTS categories (browserValue VARCHAR(15) PRIMARY KEY, categoryName VARCHAR(50));";
            MySqlCommand comm = new MySqlCommand(dbCommand, con);
            con.Open();
            comm.ExecuteNonQuery();
            con.Close();

            //Функции javascript
            JSValue categoryData = wc.ExecuteJavascriptWithResult(jsLib);
            JSValue[] records;
            records = (JSValue[])categoryData;
            JSValue[] catName = (JSValue[])records[0];
            JSValue[] browVal = (JSValue[])records[1];
            addCategoryData(catName, browVal);
              }
              catch(Exception exception)
              {
            MessageBox.Show(exception.Message);
              }
        }
开发者ID:RusskijMir,项目名称:DwarAuctionAnalyzer,代码行数:26,代码来源:API.cs

示例2: login

        public static void login (WebControl webControl1)
        {
            try
            {
                dynamic document = (JSObject)webControl1.ExecuteJavascriptWithResult("document");
                if (document == null)
                    throw new Exception("document has null value");
                dynamic element = document.getElementById("userEmail");
                if (element == null)
                    throw new Exception("email has null value");
                element.value = "[email protected]";
                element = document.getElementById("userPassword");
                element.value = "ee34nf3o";

                element = document.getElementsByTagName("input");
                for (int i = 0; i < element.length; i++)
                {
                    if (element[i].getAttribute("src") == "images/go_btn.png") ;
                    {
                        element[i].click();
                        break;
                    }
                }
                Thread.Sleep(2000);
                webControl1.Source = new Uri("http://w1.dwar.ru/area_auction.php");
            }
            catch (Exception exception)
            {
               MessageBox.Show(exception.Message);
            }   
        }
开发者ID:burnbaby,项目名称:Dwar,代码行数:31,代码来源:API.cs

示例3: getCategories

 private static dynamic getCategories(WebControl webControl1)
 {
     try
     {
         dynamic document = (JSObject)webControl1.ExecuteJavascriptWithResult("document");
         dynamic filter = document.getElementsByName("_filter[kind]");
         dynamic categories = filter[0].getElementsByTagName("*");
         return categories;
     }
     catch (Exception exception)
     {
         return null;
     }
 }
开发者ID:burnbaby,项目名称:Dwar,代码行数:14,代码来源:API.cs

示例4: getItems

 public static string[] getItems(WebControl wc)
 {
     string[] results = new string[10];
       string jsFunction = @"function hui(){var scriptTags = $(""script"", document.body.table);
             var results = [];
             for(var i = 0; i < scriptTags.length; i++)
             {
                 if(scriptTags[i].innerText.substring(0, 7) == ""art_alt"")
                 {
                     results.push(scriptTags[i].innerText);
                 }
             }
       return results;} hui();";
       JSValue itemStrings = wc.ExecuteJavascriptWithResult(jsFunction);
       JSValue[] itemStringsArray = (JSValue[])itemStrings;
       //foreach
       return results;
 }
开发者ID:RusskijMir,项目名称:DwarAuctionAnalyzer,代码行数:18,代码来源:API.cs

示例5: login

        public static void login(WebControl wc)
        {
            try
              {
            dynamic document = (JSObject)wc.ExecuteJavascriptWithResult("document");
            if (document == null)
              throw new Exception("document has null value");
            dynamic element = document.getElementById("userEmail");
            if (element == null)
              throw new Exception("email has null value");
            element.value = "[email protected]";
            element = document.getElementById("userPassword");
            element.value = "ee34nf3o";

            element = document.getElementsByTagName("input");
            element[0].click();
            Thread.Sleep(2000);
            wc.Source = new Uri("http://w1.dwar.ru/area_auction.php");
              }
              catch(Exception exception)
              {
            MessageBox.Show(exception.Message);
              }
        }
开发者ID:RusskijMir,项目名称:DwarAuctionAnalyzer,代码行数:24,代码来源:API.cs

示例6: PushButton

 public static dynamic PushButton( WebControl webBrowser, String type, int index ) {
     try {
         if ( webBrowser != null ) {
             var answer = webBrowser.Invoke( new Func<JSObject>( () => {
                 dynamic document = ( JSObject )webBrowser.ExecuteJavascriptWithResult( String.Format( "document.getElementsByTagName('submit')[{0}].click();", index ) );
                 return document;
             } ) );
             return answer;
         }
     }
     catch ( Exception exception ) {
         exception.Error();
     }
     return null;
 }
开发者ID:AIBrain,项目名称:UberScraper,代码行数:15,代码来源:Uber.cs

示例7: GetJavascriptWithResult

 /// <summary>
 /// </summary>
 /// <param name="webBrowser"></param>
 /// <param name="javascript"></param>
 /// <param name="result"></param>
 /// <returns></returns>
 public static Boolean GetJavascriptWithResult( WebControl webBrowser, String javascript, out JSValue result ) {
     result = default( JSValue );
     if ( webBrowser == null ) {
         return false;
     }
     try {
         result = ( JSValue )webBrowser.Invoke( new Func<JSValue>( () => webBrowser.ExecuteJavascriptWithResult( javascript ) ) );
         return true;
     }
     catch ( Exception exception ) {
         exception.Error();
     }
     return false;
 }
开发者ID:AIBrain,项目名称:UberScraper,代码行数:20,代码来源:Uber.cs

示例8: GetElementsByTagName

 public static dynamic GetElementsByTagName( WebControl webBrowser, String type ) {
     try {
         if ( webBrowser != null ) {
             var answer = webBrowser.Invoke( new Func<JSObject>( () => {
                 dynamic document = ( JSObject )webBrowser.ExecuteJavascriptWithResult( "document" );
                 using ( document ) {
                     try {
                         return document.getElementsByTagName( type );
                     }
                     catch ( Exception exception ) {
                         exception.Error();
                     }
                     return null;
                 }
             } ) );
             return answer;
         }
     }
     catch ( Exception exception ) {
         exception.Error();
     }
     return null;
 }
开发者ID:AIBrain,项目名称:UberScraper,代码行数:23,代码来源:Uber.cs


注:本文中的WebControl.ExecuteJavascriptWithResult方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。