セレンウェブドライバを使用してページを自動化しています。私は要素をクリックしています。コンソールでエラーはスローされません。要素がクリックされていますが、ページに影響が表示されていません。私は他の多くの要素を試しましたが、同じ問題に直面しています。すべての要素がクリックされて表示されますが、影響はありません。クリックアクションは実行されますが、セレンのページに影響はありません。
シナリオ例。私は要素の星アイコンをクリックして要素をブックマークしています。クリックすると、星は青色に変わります。実行されたコンソール表示要素がブックマークされている場合、つまり星がクリックされたことを示します。しかし、ページ上では、青色に変わらない。しかし、あなたはページをリフレッシュし、星は青いです。
誰かが問題になる可能性のある人に教えてください。
// 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");
}
}
コードを貼り付けてください。 –
コードは必要ありません。それは動作しますが、ページに影響を与えない単純なクリックです。コードなしで –
誰も助けることができますか?私たちはあなたの問題を想像することができますが、コード –