I'd like to open Google using Selenium webdriver and replace the Google logo with some other image. Of course I don't mean to change it on the server I want to do it locally in my web browser.
Is it doable?
I'd like to open Google using Selenium webdriver and replace the Google logo with some other image. Of course I don't mean to change it on the server I want to do it locally in my web browser.
Is it doable?
Add some JS that will replace an attribute with the value you need: Selenium: Can I set any of the attribute value of a WebElement in Selenium? - in your case this attribute will be the img src
value.
You can use the javascript executor to change the properties of the WebPage.
WebElement element = driver.findElement(By.xpath("//div[@id='lga']//img"));
((JavascriptExecutor)driver).executeScript("arguments[0].src='"+pathToNewImage+"'", imageElement);