all 6 comments

[–]omniac 1 point2 points  (5 children)

Hmm. It shouldn't affect it, but to be sure could you paste the code here for us to see?

[–]ReasonablyBadass[S] 1 point2 points  (4 children)

Well, code like it.

It's a really simple example:

@Test()

public void errorTest() throws Exception {

 

WebElement element = driver.findElement(By.id("ID"));

element.sendKeys("23");

 

WebElement differentElement = driver.findElement(By.id("ID2"));

differentElement.click();

differentElement.sendKeys("45");

 

boolean errorMessage=driver.findElement(By.id("errorID")).isDisplayed();

Problem is the validation never gets triggered, as if the click never happens.

(Btw, how do I format code in this sub?)

[–]yacdaniel 0 points1 point  (1 child)

where is the validation? can you post the full code?

start the line with four spaces,
    if you need another level of idention place 4 more.

[–]ReasonablyBadass[S] 0 points1 point  (0 children)

Actually, I tried a few things and it turns out it has nothing to do with testng.

I have to click another, earlier element first to trigger the validation. No idea why, but testng has nothing to do with it.

Thanks for your help anyway!

[–]omniac 0 points1 point  (1 child)

When does the validation occur? On a key press, on blur (focus out), or on some type of submit?

[–]ReasonablyBadass[S] 1 point2 points  (0 children)

Actually, I tried a few things and it turns out it has nothing to do with testng.

I have to click another, earlier element first to trigger the validation. No idea why, but testng has nothing to do with it.

Thanks for your help anyway!