שגיאה בעת קימפול קוד ב C# - תכנות - HWzone פורומים
עבור לתוכן
  • צור חשבון

שגיאה בעת קימפול קוד ב C#


assaf990

Recommended Posts

אני מקווה שעשיתי include באופן נכון לספריה שאני רוצה להשתמש בה

זה הקוד ולאחריו הודעת שגיאה

using System;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using NUnit.Framework;
using Selenium;
namespace SeleniumTests
{
[TestFixture]
public class NewTest
{
private ISelenium selenium;
private StringBuilder verificationErrors;

[SetUp]
public void SetupTest()
{
selenium = new DefaultSelenium("localhost", 4444, "*chrome", "[url]http://www.walla.co.il/"[/url]);
selenium.Start();
verificationErrors = new StringBuilder();
}

[TearDown]
public void TeardownTest()
{
try
{
selenium.Stop();
}
catch (Exception)
{
// Ignore errors if unable to close the browser
}
Assert.AreEqual("", verificationErrors.ToString());
}

[Test]
public void TheNewTest()//TheNewTest

{
selenium.Open("/");
selenium.Click("//div[@id='main']/table[1]/tbody/tr[4]/td/table/tbody/tr[2]/td[1]/table/tbody/tr/td[2]/table/tbody/tr[4]/td/form/table/tbody/tr[1]/td/table/tbody/tr[6]/td/input");
selenium.WaitForPageToLoad("30000");
selenium.Click("//img[@alt='1 מודעות']");
selenium.WaitForPageToLoad("30000");
selenium.Click("link=לפרטים");
Thread.Sleep(50000);
selenium.Click("//td[5]/a/img");
selenium.WaitForPageToLoad("30000");
Thread.Sleep(10000);
selenium.Click("link=התנתק");
selenium.WaitForPageToLoad("30000");
Thread.Sleep(300000);
}


}
}

שגיאה אחת בקימפול:

Error	1	Program 'C:\Documents and Settings\Project1\Project1\obj\Debug\Project1.exe' does not contain a static 'Main' method suitable for an entry point	Project1

קישור לתוכן
שתף באתרים אחרים


using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using NUnit.Framework;
using Selenium;

namespace SeleniumTests
{
public class Program
{
public static void Main()
{
NewTest newTest = new NewTest();
newTest.TheNewTest();
}
[TestFixture]
public class NewTest
{
private ISelenium selenium;
private StringBuilder verificationErrors;

[SetUp]
public void SetupTest()
{
selenium = new DefaultSelenium("localhost", 4444, "*chrome", "[url]http://www.walla.co.il/"[/url]);
selenium.Start();
verificationErrors = new StringBuilder();
}

[TearDown]
public void TeardownTest()
{
try
{
selenium.Stop();
}
catch (Exception)
{
// Ignore errors if unable to close the browser
}
Assert.AreEqual("", verificationErrors.ToString());
}

[Test]
public void TheNewTest()//TheNewTest

{
selenium.Open("/");
selenium.Click("//div[@id='main']/table[1]/tbody/tr[4]/td/table/tbody/tr[2]/td[1]/table/tbody/tr/td[2]/table/tbody/tr[4]/td/form/table/tbody/tr[1]/td/table/tbody/tr[6]/td/input");
selenium.WaitForPageToLoad("30000");
selenium.Click("//img[@alt='1 מודעות']");
selenium.WaitForPageToLoad("30000");
selenium.Click("link=לפרטים");
Thread.Sleep(50000);
selenium.Click("//td[5]/a/img");
selenium.WaitForPageToLoad("30000");
Thread.Sleep(10000);
selenium.Click("link=התנתק");
selenium.WaitForPageToLoad("30000");
Thread.Sleep(300000);
}


}

}
}
using System;

אם אתה משייך את הASSEMBLY הזה לאחד שיש בו Main אז אתה יוצר שם מופע של האובייקט NEWTEST ודרכו מפעיל את המתודות הרצויות..

קישור לתוכן
שתף באתרים אחרים

ארכיון

דיון זה הועבר לארכיון ולא ניתן להוסיף בו תגובות חדשות.

×
  • צור חדש...