Tag: selenium grid

参数化selenium测试与TestNG并行

首先,对不起我的英语,它不是那么完美:) 所以我面临以下问题:我正在尝试使用Selenium Grid和TestNg在不同的浏览器中运行并行测试,并且我在@BeforeTest方法中传递参数。 我的问题是,当每个测试都被初始化时,似乎他们将使用最后一个测试的参数。 因此,在此示例中,当我运行测试时,它将打开两个Chrome,而不是一个Firefox和一个Chrome。 (browser.getDriver()方法返回一个RemoteWebDriver) testng.xml文件: AbstractTest类: public class SeleniumTest { private static List webDriverPool = Collections.synchronizedList(new ArrayList()); private static ThreadLocal driverThread; public static BrowserSetup browser; @Parameters({ “browserName”, “browserVersion”, “platform”}) @BeforeTest() public static void beforeTest(String browserName, @Optional(“none”) String browserVersion, String platform) throws WrongBrowserException, WrongPlatformException { final BrowserSetup browser = new BrowserSetup(browserName, browserVersion, platform); driverThread […]

在Selenium中避免NoSuchElementException的最佳方法是什么?

我在Selenium WebDriver中使用Java编写了一些测试用例,并在网格(集线器和多个节点)上执行它们。 我注意到一些测试用例由于NoSuchElementException而失败。 什么是避免NoSuchElementException并确保始终找到元素的最佳和最强大的方法?