1

I have a problem to test the display of contxxt menu when i right-click in a compnent

this is my code HTML

<div contextmenu="menuContext" class="demo" id="global" style="display:block;"> 
    I do something ...          
</div>
<menu type="context" id="menuContext">                       
    <menuitem id="abc" label="label1" onclick="window.location='page1.html';"></menuitem>
    <menuitem id="def" label="label2" onclick="window.location='page1.html';"></menuitem>
    <menuitem id="ghi" label="label3" onclick="window.location='page3.html';"></menuitem>
    <menuitem id="jkl" label="label4" onclick="window.location='page1.html';"></menuitem>
    <menuitem id="mno" label="label5" onclick="window.location='page2.html';"></menuitem>
</menu>

This my selenium test code:

private void verifyComponent(final String myId) {
    final WebElement component = this.driver.findElement(By.id(myId));
    final boolean testComponent = component.isDisplayed();
    assertTrue("verification of compnent: ", testComponent);
}

private void verifyMCappearance() {
    final List<WebElement> elementNumList =
            this.driver.findElements(By.id("global"));
    // Taking 1st cell
    final WebElement link = elementNumList.get(0);
    // Right Clicking
    new Actions(this.driver).contextClick(link).perform();
    verifyComponent("menuContext");
}
//call method
verifyMCappearence();

so the display of my web page is correct and the right-click works and i see the context menu. but i dont know why i cant test it with assert method !!! when i see my code html in firebug, even when i right-click or not i have always the code html of context menu hidden probably that is the problem.

please help!

user3726499
  • 81
  • 4
  • 13

0 Answers0