-1

In the project, I have a dropdown of Gender in which I have 2 option Male And Female.

There are two column on a single page for 2 customers and I want to upload the images for both of them.

Is it possible to upload the image according to the gender given to the customer?

I have given male gender to first customer and female to the second customer

There are 2 clicks before the window open to select the image and I am using ubuntu that is why I am not able to send the location of the image in the window.

Please help how can I do it for 2 tines for 2 customer

I want the help in the tool or the approach which I can use to achieve this goal.

Note: I am using Ubuntu os

2 click code after which select image windows open:

driver.findElement(By.cssSelector("#displayed-photo-modal-security-243202797")).click();

    driver.findElement(By.cssSelector("#photo-modal-file-upload-input")).click();

code of click for save button:

driver.findElement(By.cssSelector("#photo-modal-save-button")).click();

path of image:

/home/administrator/Downloads/aaa.jpg

Html for 1 click

<a id="displayed-photo-modal-security-243202797" class="securityCard_link text-hide set-photo-target" href="#photo-modal" data-show-tip="show" data-container-image="" data-toggle="modal" data-type="Security">Add</a>

html for 2 click

<input id="photo-modal-file-upload-input" class="uploadFile photo-modal-upload-photo" type="file">

html for save

<a id="photo-modal-save-button" class="btn-cta btn-primary close-photo-modal" data-dismiss="modal" title="Save" data-button-type="submit">Save</a>
JeffC
  • 22,180
  • 5
  • 32
  • 55

2 Answers2

0

You can try below in Ubuntu as your home folder is available in home/administrator

File image= new File("/home/administrator/Downloads/aaa.jpg");
image.createNewFile();
FileWriter fw = new FileWriter(image.getAbsoluteFile());
BufferedWriter bw = new BufferedWriter(fw);
bw.write("#photo-modal-save-button")
Prany
  • 2,078
  • 2
  • 13
  • 31
0

Because of Ubuntu OS I an not able to upload the picture, I will be doing this task on windows OS because It is easy on Windows