עבור לתוכן
View in the app

A better way to browse. Learn more.

HWzone

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

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

Featured Replies

פורסם

אני מקווה שעשיתי 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

פורסם

אין לא נקודת התחלה.

לא הגדרת:

public static void Main

פורסם
  • מחבר

ומה עלי לרשום ב main כדי להפעיל את הפונקציה

TheNewTest?

פורסם


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 ודרכו מפעיל את המתודות הרצויות..

פורסם

השאלה היא האם אתה מנסה להריץ את הטסט או סתם להריץ את הפונקציה, אלו שני דברים שונים.

פורסם

יצאתי מהנחה שהוא רוצה להפעיל את המתודה...

ארכיון

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

דיונים חדשים

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.