org.selenide.selenoid.SelenoidClipboard Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of selenide-selenoid Show documentation
Show all versions of selenide-selenoid Show documentation
Selenide = concise API for Selenium WebDriver
package org.selenide.selenoid;
import com.codeborne.selenide.DefaultClipboard;
import com.codeborne.selenide.Driver;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static org.selenide.selenoid.SelenoidClient.clientFor;
public class SelenoidClipboard extends DefaultClipboard {
private static final Logger log = LoggerFactory.getLogger(SelenoidClipboard.class);
public SelenoidClipboard(Driver driver) {
super(driver);
}
@Override
public String getText() {
if (isLocalWebdriver()) {
log.debug("Working in local browser. Switching to a default Clipboard implementation.");
return super.getText();
}
else {
return clientFor(driver()).getClipboardText();
}
}
@Override
public void setText(String text) {
if (isLocalWebdriver()) {
log.debug("Working in local browser. Switching to a default Clipboard implementation.");
super.setText(text);
}
else {
clientFor(driver()).setClipboardText(text);
}
}
private boolean isLocalWebdriver() {
return driver().config().remote() == null;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy