Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiasstamann committed Jan 22, 2025
2 parents 7079f70 + ddf1661 commit a33c8df
Show file tree
Hide file tree
Showing 8 changed files with 72 additions and 11 deletions.
2 changes: 1 addition & 1 deletion pogen4selenium-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<groupId>io.toolisticon.pogen4selenium</groupId>
<artifactId>pogen4selenium</artifactId>
<version>0.8.0</version>
<version>0.8.1</version>
</parent>

<name>pogen4selenium-api</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import io.toolisticon.pogen4selenium.runtime.DefaultSideCondition;
import io.toolisticon.pogen4selenium.runtime.LocatorCondition;
import io.toolisticon.pogen4selenium.runtime.actions.BaseAction;

/**
* Meta-Annotation to allow custom annotations.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
package io.toolisticon.pogen4selenium.api;

public @interface ActionFileUpload {
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import io.toolisticon.pogen4selenium.runtime.DefaultSideCondition;
import io.toolisticon.pogen4selenium.runtime.LocatorCondition;
import io.toolisticon.pogen4selenium.runtime.actions.ActionFileUploadImpl;

@Target(ElementType.PARAMETER)
@Retention(RetentionPolicy.RUNTIME)
@Action(ActionFileUploadImpl.class)
public @interface ActionFileUpload {
/**
* The locator type to use. Can be ELEMENT for using a generated element or any kind of locator provided by selenium.
* @return the locator to use.
*/
_By by() default _By.ELEMENT;

/** The locator string to use. */
String value();

/**
* The locator strategy to use, will just be taken into account if by attribute is not set to ELEMENT.
* @return the Locator strategy, defaults to DefaultLocatorStrategy
*/
@ActionSideCondition
Class<? extends LocatorCondition> actionSideCondition() default DefaultSideCondition.class;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package io.toolisticon.pogen4selenium.runtime.actions;

import java.io.File;
import java.util.Arrays;
import java.util.Collection;

import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.SearchContext;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;

import io.toolisticon.pogen4selenium.runtime.LocatorCondition;

public class ActionFileUploadImpl extends BaseAction {

private final File file;

public ActionFileUploadImpl(WebDriver driver, SearchContext searchContext, LocatorCondition sideCondition, File file) {
super(driver, searchContext, sideCondition);
this.file = file;
}

@Override
public boolean checkCondition(WebDriver driver, WebElement element) {
return element.isDisplayed() && element.isEnabled();
}

@Override
public Collection<Class<? extends Throwable>> exceptionsToIgnore() {
return Arrays.asList(NoSuchElementException.class);
}


@Override
protected void applyAction(WebElement webElement) {
webElement.sendKeys(file.getAbsolutePath());
}

}
4 changes: 2 additions & 2 deletions pogen4selenium-example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<groupId>io.toolisticon.pogen4selenium</groupId>
<artifactId>pogen4selenium</artifactId>
<version>0.8.0</version>
<version>0.8.1</version>
</parent>

<name>pogen4selenium-example</name>
Expand All @@ -33,7 +33,7 @@
<dependency>
<groupId>io.toolisticon.pogen4selenium</groupId>
<artifactId>pogen4selenium-api</artifactId>
<version>0.8.0</version>
<version>0.8.1</version>
</dependency>

<dependency>
Expand Down
2 changes: 1 addition & 1 deletion pogen4selenium-processor/dependency-reduced-pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<artifactId>pogen4selenium</artifactId>
<groupId>io.toolisticon.pogen4selenium</groupId>
<version>0.7.2-SNAPSHOT</version>
<version>0.8.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>pogen4selenium-processor</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion pogen4selenium-processor/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<groupId>io.toolisticon.pogen4selenium</groupId>
<artifactId>pogen4selenium</artifactId>
<version>0.8.0</version>
<version>0.8.1</version>
</parent>

<name>pogen4selenium-processor</name>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>io.toolisticon.pogen4selenium</groupId>
<artifactId>pogen4selenium</artifactId>
<version>0.8.0</version>
<version>0.8.1</version>
<packaging>pom</packaging>
<name>pogen4selenium</name>
<description>Please refer to https://github.com/toolisticon/pogen4selenium</description>
Expand Down

0 comments on commit a33c8df

Please sign in to comment.