diff --git a/build.sbt b/build.sbt index ebd22e0..b4d0408 100644 --- a/build.sbt +++ b/build.sbt @@ -1,6 +1,6 @@ name := "robobrowser" organization := "com.outr" -version := "1.6.1" +version := "1.7.0-SNAPSHOT" val scala213: String = "2.13.11" diff --git a/src/main/resources/anticaptcha-plugin_v0.63.crx b/src/main/resources/anticaptcha-plugin_v0.63.crx deleted file mode 100644 index 22c910d..0000000 Binary files a/src/main/resources/anticaptcha-plugin_v0.63.crx and /dev/null differ diff --git a/src/main/scala/com/outr/robobrowser/RoboBrowser.scala b/src/main/scala/com/outr/robobrowser/RoboBrowser.scala index c66714a..15b8c3f 100644 --- a/src/main/scala/com/outr/robobrowser/RoboBrowser.scala +++ b/src/main/scala/com/outr/robobrowser/RoboBrowser.scala @@ -416,7 +416,7 @@ abstract class RoboBrowser(val capabilities: Capabilities) extends AbstractEleme object storage { object cookies { private implicit val ssRW: RW[SameSite] = RW.from( - r = (ss: SameSite) => ss match { + r = { case SameSite.Normal => "normal" case SameSite.Lax => "lax" case SameSite.Strict => "strict" diff --git a/src/main/scala/com/outr/robobrowser/browser/BrowserOptions.scala b/src/main/scala/com/outr/robobrowser/browser/BrowserOptions.scala index f5d640a..d0f2240 100644 --- a/src/main/scala/com/outr/robobrowser/browser/BrowserOptions.scala +++ b/src/main/scala/com/outr/robobrowser/browser/BrowserOptions.scala @@ -36,12 +36,23 @@ trait BrowserOptions[O] { def url(url: URL): O = withCapabilities("url" -> url.toString()) - def proxy(proxy: Proxy): O = { + def proxy(ftp: Option[String] = None, + http: Option[String] = None, + no: Option[String] = None, + ssl: Option[String] = None, + socks: Option[String] = None, + socksVersion: Option[Int] = None, + socksUsername: Option[String] = None, + socksPassword: Option[String] = None): O = { val p = new selenium.Proxy - // TODO: Support -// proxy.`type` match { -// case ProxyType.Direct => p.set -// } + ftp.foreach(p.setFtpProxy) + http.foreach(p.setHttpProxy) + no.foreach(p.setNoProxy) + ssl.foreach(p.setSslProxy) + socks.foreach(p.setSocksProxy) + socksVersion.foreach(i => p.setSocksVersion(i)) + socksUsername.foreach(p.setSocksUsername) + socksPassword.foreach(p.setSocksPassword) withCapabilities(CapabilityType.PROXY -> p) } } diff --git a/src/main/scala/com/outr/robobrowser/browser/firefox/Firefox.scala b/src/main/scala/com/outr/robobrowser/browser/firefox/Firefox.scala index a502dd8..c52000c 100644 --- a/src/main/scala/com/outr/robobrowser/browser/firefox/Firefox.scala +++ b/src/main/scala/com/outr/robobrowser/browser/firefox/Firefox.scala @@ -4,12 +4,21 @@ import com.outr.robobrowser.RoboBrowser import org.openqa.selenium.firefox.{FirefoxDriver, FirefoxOptions => SeleniumFirefoxOptions} import java.io.{File, FileNotFoundException} +import java.nio.file.Path class Firefox(options: SeleniumFirefoxOptions) extends RoboBrowser(options) { override type Driver = FirefoxDriver override def sessionId: String = "Firefox" + def installExtension(path: Path): String = withDriver { driver => + driver.installExtension(path) + } + + def uninstallExtension(extensionId: String): Unit = withDriver { driver => + driver.uninstallExtension(extensionId) + } + override protected def createDriver(): FirefoxDriver = new FirefoxDriver(options) }