Selenium :: Remote :: Driver:单击锚点元素不起作用

时间:2018-09-03 07:18:57

标签: selenium

我有以下html代码,其中包含一个锚点元素,我想单击该锚点元素,以便调用此元素内指定的脚本。

CREATE TABLE tmp (id INT PRIMARY KEY, contact VARCHAR(100), country VARCHAR(25))
GO

INSERT INTO tmp VALUES 
(1, 'Maria Anders', 'Germany'),
(2, 'Francisco Chang', 'Mexico'),
(3, 'Roland Mendel', 'Austria'),
(4, 'Helen Bennett', 'UK'),
(5, 'Yoshi Tannamuri', 'Canada'),
(6, 'Giovanni Rovelli', 'Italy')
GO

-- @total_bytes is the desired size of the table after the delete statement
DECLARE @total_bytes INT = 40

-- Use the SUM window function to get a running total of the DATALENGTH
-- of the VARBINARY field, and delete when the running total exceeds
-- the desired table size.
-- You can order the window function however you want to delete rows
-- in the correct sequence.
DELETE t
FROM tmp t
INNER JOIN
(
    SELECT id, SUM(DATALENGTH(contact)) OVER (ORDER BY id)
        + SUM(DATALENGTH(country)) OVER (ORDER BY id) total_size
    FROM tmp
)sq ON t.id = sq.id AND sq.total_size > @total_bytes

SELECT * FROM tmp -- 2 rows left!

我首先尝试了以下步骤,将Perl绑定到Selenium Webdriver:

  /* tslint:disable:no-unused-variable */

但是出现以下错误:

<div class="ToolsContainer">
<a target="_blank" href="checkup.aspx">
<img class="Tools-img" src="/images/tools02.jpg">
<p class="Tools-text center gray"><span class="black_bold Tool">Checkup</span>
<br>Tool area.</p></a>
</div>

这一次错误消息如下:

$elem = $selen->find_element( "(//a[\@href='checkup.aspx'])" );
print STDERR "href: " . $elem->get_attribute('href');
$selen->click();

这是怎么回事?对代码进行哪些更改(我绑定到S:R:D)可能使事情正常?

0 个答案:

没有答案