本文整理匯總了Java中org.testng.AssertJUnit.assertNotNull方法的典型用法代碼示例。如果您正苦於以下問題:Java AssertJUnit.assertNotNull方法的具體用法?Java AssertJUnit.assertNotNull怎麽用?Java AssertJUnit.assertNotNull使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.testng.AssertJUnit
的用法示例。
在下文中一共展示了AssertJUnit.assertNotNull方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: progress
import org.testng.AssertJUnit; //導入方法依賴的package包/類
public void progress() throws Throwable {
driver = new JavaDriver();
final WebElement progressbar = driver.findElement(By.cssSelector("progress-bar"));
AssertJUnit.assertNotNull("could not find progress-bar", progressbar);
AssertJUnit.assertEquals("0", progressbar.getAttribute("value"));
driver.findElement(By.cssSelector("button")).click();
Wait<WebDriver> wait = new WebDriverWait(driver, 30);
// Wait for a process to complete
wait.until(new ExpectedCondition<Boolean>() {
@Override public Boolean apply(WebDriver webDriver) {
return progressbar.getAttribute("value").equals("100");
}
});
AssertJUnit.assertEquals("100", progressbar.getAttribute("value"));
AssertJUnit.assertTrue(driver.findElement(By.cssSelector("text-area")).getText().contains("Done!"));
}
示例2: switchTo
import org.testng.AssertJUnit; //導入方法依賴的package包/類
public void switchTo() throws Throwable {
SwingUtilities.invokeAndWait(new Runnable() {
@Override public void run() {
d2 = new JDialog(frame, false);
d2.setName("dialog-2");
d2.setTitle("My Dialog 2");
JButton b = new JButton("Click-Me-2");
b.setName("click-me-2");
d2.getContentPane().add(b);
d2.pack();
d2.setVisible(true);
}
});
Collection<String> windowHandles = driver.getWindowHandles();
AssertJUnit.assertEquals(2, windowHandles.size());
driver.switchTo().window("dialog-2");
AssertJUnit.assertNotNull(driver.findElementByName("click-me-2"));
SwingUtilities.invokeAndWait(new Runnable() {
@Override public void run() {
d2.dispose();
}
});
}
示例3: findElementsOfElement
import org.testng.AssertJUnit; //導入方法依賴的package包/類
public void findElementsOfElement() throws Throwable {
driver = new JavaDriver();
SwingUtilities.invokeAndWait(new Runnable() {
@Override public void run() {
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
});
WebElement element = driver.findElement(By.name("box-panel"));
AssertJUnit.assertNotNull(element);
List<WebElement> clickMe = element.findElements(By.name("click-me"));
AssertJUnit.assertNotNull(clickMe);
}
示例4: findElement
import org.testng.AssertJUnit; //導入方法依賴的package包/類
public void findElement() throws Throwable {
driver = new JavaDriver();
SwingUtilities.invokeAndWait(new Runnable() {
@Override public void run() {
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
});
WebElement element = driver.findElement(By.name("click-me"));
AssertJUnit.assertNotNull(element);
AssertJUnit.assertEquals(EventQueueWait.call(button, "getText"), element.getText());
}
示例5: simpleSelectorWithFunctionAll
import org.testng.AssertJUnit; //導入方法依賴的package包/類
public void simpleSelectorWithFunctionAll() throws Throwable {
IJavaElement element = driver.findElementByCssSelector("button:enabled");
AssertJUnit.assertNotNull(element);
AssertJUnit.assertEquals(EventQueueWait.call(button, "getName"), element.getAttribute("name"));
SwingUtilities.invokeAndWait(new Runnable() {
@Override public void run() {
button.setEnabled(false);
}
});
element = driver.findElementByCssSelector("button:disabled");
AssertJUnit.assertNotNull(element);
AssertJUnit.assertEquals(EventQueueWait.call(button, "getName"), element.getAttribute("name"));
element = driver.findElementByCssSelector("button:displayed");
AssertJUnit.assertNotNull(element);
AssertJUnit.assertEquals(EventQueueWait.call(button, "getName"), element.getAttribute("name"));
SwingUtilities.invokeAndWait(new Runnable() {
@Override public void run() {
button.setVisible(false);
}
});
element = driver.findElementByCssSelector("button:hidden");
AssertJUnit.assertNotNull(element);
AssertJUnit.assertEquals(EventQueueWait.call(button, "getName"), element.getAttribute("name"));
element = driver.findElementByCssSelector(":instance-of('javax.swing.JButton')");
AssertJUnit.assertNotNull(element);
AssertJUnit.assertEquals(EventQueueWait.call(button, "getName"), element.getAttribute("name"));
element = driver.findElementByCssSelector("check-box:deselected");
AssertJUnit.assertNotNull(element);
AssertJUnit.assertEquals(EventQueueWait.call(checkbox, "getName"), element.getAttribute("name"));
element = driver.findElementByCssSelector(":instance-of('javax.swing.JCheckBox'):deselected");
AssertJUnit.assertNotNull(element);
AssertJUnit.assertEquals(EventQueueWait.call(checkbox, "getName"), element.getAttribute("name"));
}
示例6: findElementsByTagNameOfElement
import org.testng.AssertJUnit; //導入方法依賴的package包/類
public void findElementsByTagNameOfElement() throws Throwable {
driver = new JavaDriver();
SwingUtilities.invokeAndWait(new Runnable() {
@Override public void run() {
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
});
WebElement parent = driver.findElement(By.tagName("box"));
List<WebElement> elements = parent.findElements(By.tagName("label"));
AssertJUnit.assertNotNull(elements);
AssertJUnit.assertEquals(2, elements.size());
AssertJUnit.assertEquals("Enter The Text", elements.get(0).getText());
AssertJUnit.assertEquals("Text Field", elements.get(1).getText());
}
示例7: simpleSelector
import org.testng.AssertJUnit; //導入方法依賴的package包/類
public void simpleSelector() throws Throwable {
IJavaElement element = driver.findElementByCssSelector("button");
AssertJUnit.assertNotNull(element);
AssertJUnit.assertEquals(EventQueueWait.call(button, "getName"), element.getAttribute("name"));
}
示例8: getAttribute
import org.testng.AssertJUnit; //導入方法依賴的package包/類
public void getAttribute() throws Throwable {
String attribute = ejText.getAttribute("size");
AssertJUnit.assertNotNull(attribute);
}
示例9: parseSelfSelector
import org.testng.AssertJUnit; //導入方法依賴的package包/類
public void parseSelfSelector() throws Throwable {
SelectorParser parser = new SelectorParser(".::selected");
Selector selector = parser.parse();
AssertJUnit.assertNotNull(selector);
AssertJUnit.assertEquals(".::selected", selector.toString());
}
示例10: getLocation
import org.testng.AssertJUnit; //導入方法依賴的package包/類
public void getLocation() throws Throwable {
Point location = ejText.getLocation();
AssertJUnit.assertNotNull(location);
}
示例11: getSize
import org.testng.AssertJUnit; //導入方法依賴的package包/類
public void getSize() throws Throwable {
Dimension d = ejText.getSize();
AssertJUnit.assertNotNull(d);
}
示例12: parseSelfSelectorWithParamsEscapeBackslash
import org.testng.AssertJUnit; //導入方法依賴的package包/類
public void parseSelfSelectorWithParamsEscapeBackslash() throws Throwable {
SelectorParser parser = new SelectorParser(".::call-select('Hello\\\\ World')");
Selector selector = parser.parse();
AssertJUnit.assertNotNull(selector);
AssertJUnit.assertEquals(".::call-select(\"Hello\\ World\")", selector.toString());
}
示例13: parseTagWithIDAsString
import org.testng.AssertJUnit; //導入方法依賴的package包/類
public void parseTagWithIDAsString() throws Throwable {
SelectorParser parser = new SelectorParser("menu#'main menu'");
Selector selector = parser.parse();
AssertJUnit.assertNotNull(selector);
AssertJUnit.assertEquals("menu#\"main menu\"", selector.toString());
}
示例14: parseID
import org.testng.AssertJUnit; //導入方法依賴的package包/類
public void parseID() throws Throwable {
SelectorParser parser = new SelectorParser("#mainmenu");
Selector selector = parser.parse();
AssertJUnit.assertNotNull(selector);
AssertJUnit.assertEquals("*#mainmenu", selector.toString());
}
示例15: parseSelectorGroupAdjacentSibling
import org.testng.AssertJUnit; //導入方法依賴的package包/類
public void parseSelectorGroupAdjacentSibling() throws Throwable {
SelectorParser parser = new SelectorParser("menu+menu-item");
Selector selector = parser.parse();
AssertJUnit.assertNotNull(selector);
AssertJUnit.assertEquals("menu + menu-item", selector.toString());
}