Skip to content

Commit

Permalink
#37 Try to Fix: WebElement.click() not working on Jenkins (Approach I)
Browse files Browse the repository at this point in the history
- Clicking on the minusButton in deleteMetadata() method on the
EditItemPage is not working, when running the tests on jenkins
- Solution I: Use JavascriptExecutor.executeScript (instead of the
normally used WebElement.click()) to click on the element
  • Loading branch information
helkv committed Nov 12, 2018
1 parent 597dc6a commit 25535e3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 15 deletions.
28 changes: 14 additions & 14 deletions res/testng_edmond_firefox.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<classes>

<!-- Basic Edmond -->

<!--
<class name="test.scripts.basicEdmond.OneAuthorLogo"></class>
<class name="test.scripts.basicEdmond.OneAuthorTwoOUs"></class>
Expand All @@ -34,35 +34,35 @@
<class name="test.scripts.basicEdmond.MoveItems"></class>
<class name="test.scripts.basicEdmond.MetadataSelectedItems"></class>

-->
<!-- End of Basic Edmond -->

<!-- Basic Outbox -->

<!--
<class name="test.scripts.basicOutbox.AdminSharesWithUser"></class>
<class name="test.scripts.basicOutbox.AdminSharesWithUserGroup"></class>
<class name="test.scripts.basicOutbox.MoveItemsPrivate"></class>

-->
<!-- End of Basic Outbox -->

<!-- Cesar -->

<!--
<class name="test.scripts.cesar.CesarDefault"></class>

-->
<!-- End of Cesar -->

<!-- Gluons -->

<!--
<class name="test.scripts.gluons.Default"></class>
<class name="test.scripts.gluons.DefaultExternalInvitation"></class>

-->
<!-- End of Gluons -->

<!-- Basic Home -->

<!--
<class name="test.scripts.home.AdvancedSearchPageTest"></class>
<class name="test.scripts.home.BrowsePageTest"></class>
Expand All @@ -84,19 +84,19 @@
<class name="test.scripts.home.SearchTest"></class>
<class name="test.scripts.home.SearchSpecialCharactersTest"></class>

-->
<!-- End of Basic Home -->

<!-- Facets -->

<!--
<class name="test.scripts.facets.CreateDefaultFacets"></class>
<class name="test.scripts.facets.CreateMetadataFacet"></class>
<class name="test.scripts.facets.CreateDefaultFacetsPrivate"></class>
<class name="test.scripts.facets.CreateMetadataFacetPrivate"></class>

-->
<!-- End of Facets -->

</classes>
Expand All @@ -107,13 +107,13 @@
<classes>

<!-- Statements -->

<!--
<class name="test.scripts.statements.CreateDefaultStatementTest"></class>
<class name="test.scripts.statements.CreateNewStatementTest"></class>
<class name="test.scripts.statements.CreateDefaultStatementPrivate"></class>

-->
<class name="test.scripts.statements.CreateNewStatementPrivate"></class>

<!-- End of Statements -->
Expand Down
6 changes: 5 additions & 1 deletion src/spot/pages/registered/EditItemPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.util.List;

import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
Expand Down Expand Up @@ -84,7 +85,10 @@ private void deleteMetadata(String metaDataLabelName) {
String currentName = metaDataLabel.getText();
if (currentName.equals(metaDataLabelName)) {
WebElement minusButton = metaDataLabel.findElement(By.xpath("./following-sibling::div/a[contains(@class,'fa-minus-square-o')]"));
minusButton.click();
//FIXME: On Jenkins the waiting for the staleness does not work -> reason?
// Try: Use a JavaSript click on the minusButton OR wait for the invisibility of metaDataLabel OR wait for another stale element to become stale
((JavascriptExecutor) driver).executeScript("arguments[0].click();", minusButton);
// minusButton.click();
wait.until(ExpectedConditions.stalenessOf(metaDataLabel));
break;
}
Expand Down

0 comments on commit 25535e3

Please sign in to comment.