J'automatise une page en utilisant le pilote web de sélénium. Je clique sur un élément. Dans la console aucune erreur n'est levée. L'élément est en cours de clic, mais aucun impact n'est visible sur la page. J'ai essayé avec beaucoup d'autres éléments, mais face au même problème. Chaque élément est affiché comme cliqué, mais aucun impact.Cliquez sur l'action est effectuée, mais aucun impact n'est montré dans la page en sélénium
Exemple de scénario. Je marque un élément en cliquant sur l'icône en forme d'étoile sur l'élément. Une fois cliqué, l'étoile devrait devenir bleue. Lorsque la console est exécutée, l'élément affiche un signet, c'est-à-dire que l'étoile est cliquée. Mais à la page, la partie ne devient pas bleue. Mais si vous rafraîchissez la page, l'étoile est en bleu.
Quelqu'un peut-il m'aider quel pourrait être le problème?
// Method to add a part to bookmarks on results panel
public void addPartToBookmarksOnResultsPanel(String partName)
throws OnePartException {
helper = new HelperClass(driver);
String trimmedPartName = partName.trim();
// get the count of search results
int resultsCount = helper.getResultsCount();
boolean matchFound = false;
// get all the search results and iterate through them to find the
// required part to be bookmarked.
for (int i = 1; i <= resultsCount; i++) {
// Get the name of the part to be bookmarked
String part = driver
.findElement(
By.xpath("//div[@class='widgetContent']//div[" + i
+ "]//div//div[2]//div//h3//a")).getText()
.trim();
// if obtained part name is same as expected part name, then
// click
// corresponding part's bookmark icon.
if (part.equalsIgnoreCase(trimmedPartName)) {
matchFound = true;
// Check whether the part is already bookmarked or not
String bookmarkStatus = driver.findElement(
By.xpath("//div[@id='resultList']/div/div[" + i
+ "]/div/div[2]/div/div/div[2]/span"))
.getAttribute("class");
// If already bookmarked, then show the message
if (bookmarkStatus.equalsIgnoreCase("addToBasket active")) {
logger.info("Part" + trimmedPartName
+ "is already bookmarked");
} else {
click(driver.findElement(By
.xpath("//div[@id='resultList']/div/div[" + i
+ "]/div/div[2]/div/div/div[2]/span/span")));
// Check whether notification is displayed
String bookmarkSuccessNotofication = helper
.getNotificationMessage();
logger.info("part "
+ partName
+ " is suucessfully bookmarked and notification reads "
+ bookmarkSuccessNotofication);
// Thread.sleep(6000);
}
break;
}
}
// If part is not found in the results, throw an error
if (!matchFound) {
logger.error("Part " + partName
+ " is not found in the Results. Error in bookmarking it");
throw new OnePartException("Part " + partName
+ " is not found in the Results. Error in bookmarking it");
}
}
Veuillez coller votre code –
Je pense qu'il n'y a pas besoin de code. C'est un simple clic qui fonctionne mais aucun impact sur la page. –
sans code personne ne peut aider? nous pouvons imaginer votre problème mais pas le code –