1

I'm using Watin like so:

private IE myie;
private void button1_Click(object sender, EventArgs e)
{
    try
    {
        myie = new IE();
    }
    catch (Exception ex)
    {
        return;
    }

    myie.GoTo("http://www.google.com");
    myie.WaitForComplete();

}

The problem is, however, once browser window is opened - my C# app starts to consume CPU. According to task manager - in IDLE state my program consumes from 7% to 20% CPU power. (I have AMD 2core 5000+)

Once you close the IE instance (window) - CPU usage problem disappears, so the problem lies somewhere within Watin.

Who do I fix it? What causes CPU drain?

Here, proof:

enter image description here

Project: download on skydrive

Can anybody confirm the bug? Or maybe it's just my PC fails at some point

4

1 回答 1

1

请记住——我相信你已经知道这一点——WatiN 是开源的,所以其中会有错误。和你一样,在IE 和 Firefox中启动表单时,我的 CPU 使用率都会飙升;但在很短的时间内恢复正常。我对您的建议是联系 WatiN 团队。我也在下面发布了我的代码:

namespace WindowsFormsApplication1
{
    using System;
    using System.Windows.Forms;
    using WatiN.Core;

    public partial class Form1 : System.Windows.Forms.Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
               IE testIE = new IE("http://www.google.com");
               //FireFox testFF = new FireFox("http://www.google.com");
            }

            catch (Exception exc)
            {
               MessageBox.Show(exc.Message);
            }
         }
     }
 }
于 2013-02-07T20:45:13.293 回答