Multiple attribute values from xpath

閲覧: 35 回
最初の未読メッセージにスキップ

Jonn Doe

未読、
2024/05/10 6:23:025月10日
To: Selenium Users

If I want to get the text from an a tag which is under a div i'd do....

elem = driver.find_element(By.XPATH,'//div/a).text

But what I want is the text and the href. The reason being I don't want to iterate over a huge list getting each a.href and a.text as it is slow I want to the browser to do the work upfront and hope its quicker, so is it possible getting multiple attributes from a xpath ?

Thank you.
E

Nortier David

未読、
2024/05/13 2:47:065月13日
To: seleniu...@googlegroups.com

Hello

 

Yes you can 😊

 

See the ‘and/or’ fonctions

 

Ex: .FindElement(How.XPath, "//*[contains(@class, 'menu') and text()='History']"));

 

 

 

De : seleniu...@googlegroups.com <seleniu...@googlegroups.com> De la part de Jonn Doe
Envoyé : vendredi 10 mai 2024 12:23
À : Selenium Users <seleniu...@googlegroups.com>
Objet : [selenium-users] Multiple attribute values from xpath

 

ATTENTION : cet e-mail provient d'une personne externe. Vérifiez toujours l’expéditeur avant d’ouvrir les pièces jointes ou de cliquer sur les liens.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/f3229458-631c-49e3-842b-abfcb1c403d2n%40googlegroups.com.


====== DISCLAIMER ======

https://www.cph.be/maildisclaimer

全員に返信
投稿者に返信
転送
新着メール 0 件