我的代码中的列表组件和超链接不起作用。

huangapple go评论64阅读模式
英文:

My code at a list component and href link doesn´t work

问题

Here is the translated code part:

type <li data-id="rds">
<a href="/apps/rds/" tabindex="3">
<img class="app-icon" alt="" src="/apps/rds/img/research-white.svg">
<div class="icon-loading-dark" style="display:none;"></div>
<span>
RDS App </span>
</a>
</li>
driver.find_elements(By.LINK_TEXT, " RDS App ").click()

And the issue:

This Python-Code doesn't work!

He shows: driver.find_elements(By.LINK_TEXT, " RDS App ").click()
AttributeError: 'list' object has no attribute 'click'

Let me know if you need further assistance.

英文:
type &lt;li data-id=&quot;rds&quot;&gt;
&lt;a href=&quot;/apps/rds/&quot; tabindex=&quot;3&quot;&gt;
&lt;img class=&quot;app-icon&quot; alt=&quot;&quot; src=&quot;/apps/rds/img/research-white.svg&quot;&gt;
&lt;div class=&quot;icon-loading-dark&quot; style=&quot;display:none;&quot;&gt;&lt;/div&gt;
&lt;span&gt;
RDS App	&lt;/span&gt;
&lt;/a&gt;
&lt;/li&gt;

type here


driver.find_elements(By.LINK_TEXT,&quot; RDS App &quot;).click()
here

This Python-Code doesn´t work!

He shows: driver.find_elements(By.LINK_TEXT," RDS App ").click()
AttributeError: 'list' object has no attribute 'click'

I want to test the rds app Link!

答案1

得分: 1

Your result is a list, which doesn't have the click method. Try grabbing the first element of the list with this: driver.find_elements(By.LINK_TEXT, " RDS App ")[0].click()

英文:

Your result is a list, which doesn't have the click method. Try grabbing the first element of the list with this: driver.find_elements(By.LINK_TEXT,&quot; RDS App &quot;)[0].click()

huangapple
  • 本文由 发表于 2023年5月10日 20:35:31
  • 转载请务必保留本文链接:https://go.coder-hub.com/76218501.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定