12
Answers

Changing the image on the website to a new one with selenium

Mehmet Fatih

Mehmet Fatih

1y
457
1

I want to replace a person's picture in a certain folder with a new one using Selenium. How can I select the picture according to the person's information by pressing the upload button under the picture and replace it with a new one? In my codes, it constantly clicks on the upload button and does not upload by selecting the image.

var FilePath = System.Windows.Forms.Application.StartupPath + "\\resimler\\ " + jpgname + ".jpg";
Actions actions = new Actions(drv);
WebElement uploadPhotoBtn = (WebElement)drv.FindElement(By.XPath("//*[@id=\"flResimSec\"]"));
actions.MoveToElement(uploadPhotoBtn).Click().Perform();

 

Answers (12)