T
T
TechNOIR2017-03-02 14:09:01
PowerShell
TechNOIR, 2017-03-02 14:09:01

selenium. How to get a link (img src) to an image?

Good afternoon. There is a picture for the material at
this darksound.ru/dark-electro/213830-synapsyche-the-ab... address. How to get its link using Selenium? Xpath,By ClassName, ByTag?
I tried a bunch of options, I just can not get it. Tell me please. Thanks in advance.
The site code looks like this:

<td class="stars" style="width: 200px;" align="left" width="200" valign="top">
            <img src="http://darksound.ru/uploads/oblozki/file_6lXCuJRVH0y5AX992vsF.jpg" alt="Synapsyche - The Abyss Effect" height="200" border="0" width="200"></td>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
azarij, 2017-03-02
@azarij

$uri = " darksound.ru/dark-electro/213830-synapsyche-the-ab... "
add-type -path C:\test\selenium\net40\WebDriver.dll
$driver = New-Object OpenQA.Selenium. Chrome.ChromeDriver
$driver.url = $uri
($driver.FindElementsByclassname("stars")).findelementbytagname("img").getattribute("src")
$driver.Quit()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question