HezzelQuartz Posted February 23 Posted February 23 How to define Webdriver $sSelector or $_WD_LOCATOR in this element below: <a class="btn btn-grad-orange" href="/wallet/login.asp">Login</a> Can i use $_WD_LOCATOR_ByXPath for this? Thank You
Danp2 Posted February 24 Posted February 24 Yes, you can use any type of selector you would like to use. Have you tried using _WD_LinkClickByText? Latest Webdriver UDF Release Webdriver Wiki FAQs
HezzelQuartz Posted February 24 Author Posted February 24 (edited) 5 hours ago, Danp2 said: Yes, you can use any type of selector you would like to use. Have you tried using _WD_LinkClickByText? No, I haven't tried _WD_LinkClickByText but How to use $_WD_LOCATOR_ByXPath in my case? Edited February 24 by HezzelQuartz
Solution SOLVE-SMART Posted February 24 Solution Posted February 24 (edited) Hi @HezzelQuartz 👋 , my assumption is something like this: <body> <div> <form> <a class="btn btn-grad-orange" href="/wallet/login.asp">Login</a> </form> </div> </body> Now only some of the locator strategy options: ; XPath selector //a[@href='/wallet/login.asp'] //a[contains(@href, 'login.asp') and text()='Login'] ; CSS selector a[href='/wallet/login.asp'] ; or by link text ; or by class name ; or by tag name In AutoIt (au3WebDriver), I personally use XPath as default locator strategy. In other frameworks like WebdriverIO, (Selenium) or Playwright, I often use CSS selectors. You can generate several of them directly in Chrome (for example). See the following screenshot: Open the Browser DevTools with F12. (1) right click on your target element (2) copy > (3) choose your locator strategy now use it in AutoIt 😀 Best regards Sven Edited February 24 by SOLVE-SMART ==> AutoIt related: 🔗 GitHub, 🔗 Discord Server, 🔗 Cheat Sheet, 🔗 autoit-webdriver-boilerplate Spoiler 🌍 Au3Forums 🎲 AutoIt (en) Cheat Sheet 📊 AutoIt limits/defaults 💎 Code Katas: [...] (comming soon) 🎭 Collection of GitHub users with AutoIt projects 🐞 False-Positives 🔮 Me on GitHub 💬 Opinion about new forum sub category 📑 UDF wiki list ✂ VSCode-AutoItSnippets 📑 WebDriver FAQs 👨🏫 WebDriver Tutorial (coming soon)
HezzelQuartz Posted February 24 Author Posted February 24 2 hours ago, SOLVE-SMART said: Hi @HezzelQuartz 👋 , my assumption is something like this: <body> <div> <form> <a class="btn btn-grad-orange" href="/wallet/login.asp">Login</a> </form> </div> </body> Now only some of the locator strategy options: ; XPath selector //a[@href='/wallet/login.asp'] //a[contains(@href, 'login.asp') and text()='Login'] ; CSS selector a[href='/wallet/login.asp'] ; or by link text ; or by class name ; or by tag name In AutoIt (au3WebDriver), I personally use XPath as default locator strategy. In other frameworks like WebdriverIO, (Selenium) or Playwright, I often use CSS selectors. You can generate several of them directly in Chrome (for example). See the following screenshot: Open the Browser DevTools with F12. (1) right click on your target element (2) copy > (3) choose your locator strategy now use it in AutoIt 😀 Best regards Sven Thank You Really Helpful for me SOLVE-SMART 1
HezzelQuartz Posted March 3 Author Posted March 3 (edited) @SOLVE-SMART expandcollapse popup<body id="body-overlay"> <div class="xyz-content"> <div class="container"> <div class="xyz-wrapcontent"> <div id="history" class="xyz-history-container"> <div class="xyz-history-content"> <div id="tbl" class="xyz-history-table-content"> <table class="table table-hover table-sm table-striped" style="width:100%"> <tbody> <tr> <td> <ul> <li> ::marker <strong>Transaction ID:</strong> 4537988 </li> </ul> </td> </tr> <tr> <td> <ul> <li> ::marker <strong>Transaction ID:</strong> 4537107 </li> </ul> </td> </tr> <tr> <td> <ul> <li> ::marker <strong>Transaction ID:</strong> 4537092 </li> </ul> </td> </tr> </tbody> </div> </div> </div> </div> </div> </div> </div> </body> how about my example above? How to use Webdriver to get first, second, and third Transaction ID? I Want to get the text Or Maybe I Think I should create new thread Edited March 3 by HezzelQuartz
SOLVE-SMART Posted March 4 Posted March 4 (edited) Hi @HezzelQuartz , new threads are often the better way, yes. So my answer (possible solution) can be found in through 🔗 this post. Best regards Sven Edited March 5 by SOLVE-SMART ==> AutoIt related: 🔗 GitHub, 🔗 Discord Server, 🔗 Cheat Sheet, 🔗 autoit-webdriver-boilerplate Spoiler 🌍 Au3Forums 🎲 AutoIt (en) Cheat Sheet 📊 AutoIt limits/defaults 💎 Code Katas: [...] (comming soon) 🎭 Collection of GitHub users with AutoIt projects 🐞 False-Positives 🔮 Me on GitHub 💬 Opinion about new forum sub category 📑 UDF wiki list ✂ VSCode-AutoItSnippets 📑 WebDriver FAQs 👨🏫 WebDriver Tutorial (coming soon)
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now