mercredi 5 décembre 2018

How can I select checkbox in selenium without knowing the value

Thanks to everyone who read this topic. I'm working on an automatic test of Poker game in selenium. When testing the change card option. I have no idea how can i select the checkbox. Here is an screenshot of the element inspection.

Because the card is randomly drawn from the pool, i can't know the value of that checkbox when coding. And i tried to click on the card, but seems not working (There is a text telling what card is changed after selection, and I used thread.sleep to pause the thread and check the automated window)

    this.waitForDisplayed(this.indexPage.card1).isEnabled();
    this.indexPage.card1.click();
    this.indexPage.card2.click();

And here is where the indexPage.card is defined

@FindBy(id = "PlayerCard1")
public WebElement card1;
@FindBy(id = "PlayerCard2")
public WebElement card2;
@FindBy(id = "PlayerCard3")
public WebElement card3;
@FindBy(id = "PlayerCard4")
public WebElement card4;
@FindBy(id = "PlayerCard5")
public WebElement card5;




Aucun commentaire:

Enregistrer un commentaire