0
votes

une classe div contient onclick élément comment le gérer en sélénium

Mon HTML contient le code ci-dessous. Comment puis-je le gérer dans sélénium?

WebElement NextPageFind= driver.findElement(By.xpath("//span[@onclick='javascript:getNextpage('PageName','ID');')]"));
NextPageFind.click();


0 commentaires

3 Réponses :


1
votes

Changer span à div xxx

ie xxx


0 commentaires

1
votes

Votre xPath peut être:

provision-1: xxx

provision-2: xxx

provision -3:

pilote.findellement (by.xpath ("// div [@ ongcick = 'getnextpage (" pagename "," ID ")']") "). Cliquez sur ();


0 commentaires

0
votes

Vous devez changer votre xpath en quelque chose comme ce que j'ai ci-dessous. Changé d'une portée à un div et rangé la chaîne @onclick.

Les éléments de chaîne internes du XPath doivent être échappés sinon il n'est pas interprété comme un XPath valide: P>

WebElement NextPageFind= driver.findElement(By.xpath('//div[@onclick="getNextpage(\'PageName\',\'ID\')"]'));


0 commentaires