i am using this code but it returns me the name of the image name with the url
IWebElement element = driver.FindElement(By.XPath("Your xpath"));
string path = element.GetAttribute("src");
result:
http://nameofthehost/imagename.jpg
what i would like is just to spit me the src name, how would i do that?
Some browsers return the full URL in JavaScript, even if a relative URL is specified in the HTML source. So that you don’t have to special-case your code based on the browser you’re using WebDriver normalizes all properties and attributes that contain URLs to return the full URL. To solve the problem, you can use JavaScript directly.