0

I have an automation service I build and before you run the automation you give it a link so when you start the automation you get first redirect to this link.

On my machine you get redirected perfectly, but on a friend machine the Firefox browser is opened and thats it.

does anyone know what might be the issue?

here is the class that responsible for this:

case class csvUploadData(clientUrl: String)
  val csvUploadForm = Form(
    mapping(
      "clientUrl" -> nonEmptyText)(csvUploadData.apply)(csvUploadData.unapply))

  def uploadCSV = Action.async(parse.multipartFormData) { implicit request =>
    csvUploadForm.bindFromRequest.fold(
      formWithErrors => {
        Future {
          Redirect(routes.Application.index).flashing(
            "error" -> formWithErrors.error("clientUrl").get.message)
        }
      },
      userData => {
        request.body.file("csvFile").fold(Future {
          Redirect(routes.Application.index).flashing(
            "error" -> "Missing CSV file").withSession(request.session)
        }) { formFile =>
          import java.io.File
          val filename = formFile.filename
          Future {
            val file = formFile.ref.file
            val purchaseInfos = purchaseDS(file)

            val t = Try {
              val driver: WebDriver = new FirefoxDriver
              val actions: ActionsHMRC = new ActionsHMRC(driver, userData.clientUrl)

              val results = actions.insertData(purchaseInfos)
              results.filter(_._2.isFailure)
            }
            t match {
              case Success(failures) =>
                val failedMsg = if (failures.nonEmpty)
                  failures.map{case (pi, err) => s"${pi.invoiceNumber} -> ${err}}"}.mkString("The following rows failed: [\n","\n","\n\n\n]")
                else ""
                Redirect(routes.Application.index).flashing(
                "success" -> s"The file '$filename' automation successfuly.\n$failedMsg")
              case Failure(e) =>
                println(e)
                Redirect(routes.Application.index).flashing (
                "error" -> s"The file '$filename' automation failed.")
            }
          }
        }
      })
  }
}

I have ver 42.0 and he have 43.0.4

5
  • Is selenium JAR version is same in both machines? latest jars 2.50.1 supports both and also in friend machine he manually able to navigate that link? Commented Feb 2, 2016 at 8:22
  • Can you post the code? Commented Feb 2, 2016 at 8:24
  • its a whole proj, which part of the code do you want to see? Commented Feb 2, 2016 at 8:24
  • The code which is not working Commented Feb 2, 2016 at 8:31
  • @MosamMehta done, added it Commented Feb 2, 2016 at 8:31

1 Answer 1

2

I think that's happening because the new issue occurs with latest update of Mozilla firefox.

It's happening with me too.

To overcome from this issue you need to setPreference as xpinstall.signatures.required", false to firefox Profile and then pass it to driver object

firefoxProfile.setPreference("xpinstall.signatures.required", false);

Below code is working fine for old selenium jars.

static WebDriver driver=null;
public static void main(String[] args) {
final FirefoxProfile firefoxProfile = new FirefoxProfile();
firefoxProfile.setPreference("xpinstall.signatures.required", false);
driver = new FirefoxDriver(firefoxProfile);
driver.get("https://www.google.de/");

Thanks it really helps but one change FirefoxDriver(firefoxProfile) is not valid. instead FirefoxOptions as below:

final FirefoxProfile firefoxProfile = new FirefoxProfile();
firefoxProfile.setPreference("xpinstall.signatures.required", false);
FirefoxOptions firefoxOptions = new FirefoxOptions();
firefoxOptions.setProfile(firefoxProfile);
driver = new FirefoxDriver(firefoxOptions);
Sign up to request clarification or add additional context in comments.

2 Comments

Welcome ... It's my pleasure :)
@Katta Nagarjuna - Yes that is because I have posted that answer in Feb 2 16 and then FirefoxProfile was valid.. in new jar FirefoxProfile is deprecated and so now we need to use firefoxOptions. Thanks for updating the answer. really appreciated

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.