Note that there are some explanatory texts on larger screens.

plurals
  1. POWhen use annotation @Parameters, I get 2 error messages "The annotation @Parameter is disallowed for this location" . Not sure why?
    primarykey
    data
    text
    <p>I have been following some blogs &amp; the testng site to get this working, the idea behind using parameters is to pass the browser value from testng.xml file. But when I put the @Parameters annotaion error comes up in eclipse before running the script. Error comes up when I try to validate the code - </p> <p><strong>Error Message</strong> </p> <p><em>Multiple markers at this line - The attribute value is undefined for the annotation type Parameter - Parameter cannot be resolved to a type - The annotation @Parameter is disallowed for this location</em></p> <p>Think something is a miss here maybe a wrong import or some syntax error. I have done also done import for </p> <pre><code>import com.beust.jcommander.Parameter; import com.beust.jcommander.Parameters; </code></pre> <p>But does not work. Have tried to put the @Parameters annotation below the @Test, but even that does not work.</p> <p>Here is my code - </p> <pre><code>import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; import java.net.MalformedURLException; import java.net.URL; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebDriverBackedSelenium; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.remote.DesiredCapabilities; import org.openqa.selenium.remote.RemoteWebDriver; import org.testng.annotations.Test; import org.testng.annotations.Parameters; import org.testng.annotations.*; import com.thoughtworks.selenium.DefaultSelenium; import com.thoughtworks.selenium.Selenium; public class first_class { private Selenium selenium; public String url = "http://google.com/"; @Parameter ({ "browser" }) @Test public void Test(String browser) throws MalformedURLException { DesiredCapabilities capability = new DesiredCapabilities(); capability.setBrowserName(browser); WebDriver driver = null; try { driver = new RemoteWebDriver(new URL("http://localhost:".concat( "4444").concat("/wd/hub")), capability); System.out.println(); } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); } selenium = new WebDriverBackedSelenium(driver, "http://www.google.com/"); System.out.println("In Test Methos"); selenium.open("http://www.google.com/"); System.out.println(selenium.getTitle() + "in in Test Method"); selenium.close(); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload