Uploading file is not working when using SeleniumGrid

462 views
Skip to first unread message

Seife Kassahun

unread,
Oct 23, 2017, 10:50:41 AM10/23/17
to Serenity BDD Users Group
Below is the code snippet and the error output :
    EnvironmentVariables variables = SystemEnvironmentVariables.createEnvironmentVariables();
    String cohortsDirectory = variables.getProperty("quality.application.cohorts.directory");
    @FindBy(xpath = ".//input[@id='fileupload']")
    WebElementFacade uploadCohort;
    upload(System.getProperty("user.dir") + cohortsDirectory + file).fromLocalMachine().to(uploadCohort);

TEST FAILED WITH ERROR: Verify if a cohort can be imported
---------------------------------------------------------------------
[main] ERROR net.serenitybdd.core.Serenity - TEST FAILED AT STEP Import cohort: QPID Patient List, test_QPID_Patient_List, test_description, Qpid_Patient.xlsx
[main] ERROR net.serenitybdd.core.Serenity - The following error occurred: invalid argument: File not found : C:\Users\skassahun\Documents\qpid\qa\scripts\QualityAutomation\src\test\resources\cohorts\Qpid_Patient.xlsx  (Session info: chrome=61.0.3163.100)  (Driver info: chromedriver=2.33.506120 (e3e53437346286c0bc2d2dc9aa4915ba81d9023f),platform=Windows NT 6.3.9600 x86_64) (WARNING: The server did not provide any stacktrace information)Command duration or timeout: 18 millisecondsBuild info: version: '3.3.1', revision: '5234b32', time: '2017-03-10 09:04:52 -0800'System info: host: 'WIN-3JCJHFULJCE', ip: 'x.x.x.x', os.name: 'Windows Server 2012 R2', os.arch: 'amd64', os.version: '6.3', java.version: '1.8.0_144'Driver info: org.openqa.selenium.chrome.ChromeDriverCapabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, networkConnectionEnabled=false, chrome={chromedriverVersion=2.33.506120 (e3e53437346286c0bc2d2dc9aa4915ba81d9023f), userDataDir=C:\Users\QAUser\AppData\Local\Temp\4\scoped_dir4328_24003}, takesHeapSnapshot=true, pageLoadStrategy=normal, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false, version=61.0.3163.100, platform=WIN8_1, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true, setWindowRect=true, unexpectedAlertBehaviour=}]Session ID: c672ebb4f150266247564c42e124c5faCommand duration or timeout: 0 millisecondsBuild info: version: '3.5.3', revision: 'a88d25fe6b', time: '2017-08-29T12:42:44.417Z'System info: host: 'xxxxx', ip: 'x.x.x.x', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_131'Driver info: driver.version: unknown

Snippet from POM file :
 <serenity.version>1.6.3</serenity.version>
        <serenity.cucumber.version>1.5.9</serenity.cucumber.version>


John Smart

unread,
Oct 23, 2017, 11:00:07 AM10/23/17
to Seife Kassahun, Serenity BDD Users Group
"fromLocalMachine()" uses the LocalFileDetector, which will not work on a remote machine unless the file is in the same local directory on the remote machine. Uploading a file from the class path is more reliable.

--
You received this message because you are subscribed to the Google Groups "Serenity BDD Users Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to thucydides-users+unsubscribe@googlegroups.com.
To post to this group, send email to thucydides-users@googlegroups.com.
Visit this group at https://groups.google.com/group/thucydides-users.
For more options, visit https://groups.google.com/d/optout.



--
___________________________________________________
John Smart | Wakaleo Consulting  |  +44 7398 832273
Making smart teams collaborate better
http://johnfergusonsmart.com  |  john....@wakaleo.com
___________________________________________________

We love breaking down silos and helping smart teams collaborate better! Ask about our tailored on-site workshops in Agile Product Planning, BDD Requirements Discovery,  BDD, TDD and Clean Coding, and Advanced BDD Test Automation.

Need some help with Serenity BDD? Check out our Serenity BDD training and support packages here.
___________________________________________________

Seife Kassahun

unread,
Oct 23, 2017, 11:20:44 AM10/23/17
to Serenity BDD Users Group
I am getting this error after upgrading to the latest serenity core(1.6.6) and serenity cucumber(1.5.15) since the previous version does not support uploading from class path :
TEST FAILED WITH ERROR: Verify if a cohort can be imported
---------------------------------------------------------------------
[main] ERROR net.serenitybdd.core.Serenity - TEST FAILED AT STEP Import cohort: QPID Patient List, test_QPID_Patient_List, test_description, Qpid_Patient.xlsx
[main] ERROR net.serenitybdd.core.Serenity - The following error occurred: File not found on classpath: C:\Users\skassahun\Documents\qpid\qa\scripts\QualityAutomation\src\test\resources\cohorts\Qpid_Patient.xlsx
[pool-3-thread-1] INFO net.thucydides.core.reports.json.JSONTestOutcomeReporter - Generating JSON report for Verify if a cohort can be imported to file C:\Users\skassahun\Documents\qpid\qa\scripts\QualityAutomation\target\site\serenity\ddbe9fd1ebd2616172f0bd2a78f066509c83d4786d5f5208985e30641291bcdc.json (using temp file C:\Users\skassahun\Documents\qpid\qa\scripts\QualityAutomation\target\site\serenity\ddbe9fd1ebd2616172f0bd2a78f066509c83d4786d5f5208985e30641291bcdc.json42fa29bf-76a2-45e9-b961-5211c1e2aa8f)
[pool-4-thread-1] INFO net.thucydides.core.reports.html.HtmlAcceptanceTestReporter - GENERATING HTML REPORT FOR Create a logic using different type of operations:Verify if a cohort can be imported in ddbe9fd1ebd2616172f0bd2a78f066509c83d4786d5f5208985e30641291bcdc.html in directory target\site\serenity
[main] ERROR net.serenitybdd.core.Serenity -

It would be also great if you make available sample projects that runs on selenium grid 

On Monday, October 23, 2017 at 11:00:07 AM UTC-4, John Ferguson Smart wrote:
"fromLocalMachine()" uses the LocalFileDetector, which will not work on a remote machine unless the file is in the same local directory on the remote machine. Uploading a file from the class path is more reliable.
On 23 October 2017 at 15:50, Seife Kassahun <seif...@gmail.com> wrote:
Below is the code snippet and the error output :
    EnvironmentVariables variables = SystemEnvironmentVariables.createEnvironmentVariables();
    String cohortsDirectory = variables.getProperty("quality.application.cohorts.directory");
    @FindBy(xpath = ".//input[@id='fileupload']")
    WebElementFacade uploadCohort;
    upload(System.getProperty("user.dir") + cohortsDirectory + file).fromLocalMachine().to(uploadCohort);

TEST FAILED WITH ERROR: Verify if a cohort can be imported
---------------------------------------------------------------------
[main] ERROR net.serenitybdd.core.Serenity - TEST FAILED AT STEP Import cohort: QPID Patient List, test_QPID_Patient_List, test_description, Qpid_Patient.xlsx
[main] ERROR net.serenitybdd.core.Serenity - The following error occurred: invalid argument: File not found : C:\Users\skassahun\Documents\qpid\qa\scripts\QualityAutomation\src\test\resources\cohorts\Qpid_Patient.xlsx  (Session info: chrome=61.0.3163.100)  (Driver info: chromedriver=2.33.506120 (e3e53437346286c0bc2d2dc9aa4915ba81d9023f),platform=Windows NT 6.3.9600 x86_64) (WARNING: The server did not provide any stacktrace information)Command duration or timeout: 18 millisecondsBuild info: version: '3.3.1', revision: '5234b32', time: '2017-03-10 09:04:52 -0800'System info: host: 'WIN-3JCJHFULJCE', ip: 'x.x.x.x', os.name: 'Windows Server 2012 R2', os.arch: 'amd64', os.version: '6.3', java.version: '1.8.0_144'Driver info: org.openqa.selenium.chrome.ChromeDriverCapabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, networkConnectionEnabled=false, chrome={chromedriverVersion=2.33.506120 (e3e53437346286c0bc2d2dc9aa4915ba81d9023f), userDataDir=C:\Users\QAUser\AppData\Local\Temp\4\scoped_dir4328_24003}, takesHeapSnapshot=true, pageLoadStrategy=normal, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false, version=61.0.3163.100, platform=WIN8_1, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true, setWindowRect=true, unexpectedAlertBehaviour=}]Session ID: c672ebb4f150266247564c42e124c5faCommand duration or timeout: 0 millisecondsBuild info: version: '3.5.3', revision: 'a88d25fe6b', time: '2017-08-29T12:42:44.417Z'System info: host: 'xxxxx', ip: 'x.x.x.x', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_131'Driver info: driver.version: unknown

Snippet from POM file :
 <serenity.version>1.6.3</serenity.version>
        <serenity.cucumber.version>1.5.9</serenity.cucumber.version>


--
You received this message because you are subscribed to the Google Groups "Serenity BDD Users Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to thucydides-use...@googlegroups.com.
To post to this group, send email to thucydid...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages