CaptainBeardsEyesBeard Posted March 19 Share Posted March 19 I'm wondering how I should be using this? Is this correct? I'm putting the Xpath followed by "//option[2]" but I don't think this is correct _WD_ElementOptionSelect($sSession, $_WD_LOCATOR_ByXPath, '//*[@id="titleInProceedings"]/div/div[1]/div[1]//option[2]') But this fails because it's now looking for an xpath with //option[2] on the end. Log _WD_FindElement ==> No match [8] : Parameters: Strategy=xpath Selector=//*[@id="titleInProceedings"]/div/div[1]/div[1]//option[2] StartNodeID= Multiple=Default ShadowRoot=Default _WD_ElementOptionSelect ==> No match [8] : Parameters: Strategy=xpath Selector=//*[@id="titleInProceedings"]/div/div[1]/div[1]//option[2] StartElement=Default Can anyone post an example of using this function to select the first item in the dropdown list? Thanks so much! Link to comment Share on other sites More sharing options...
Danyfirex Posted March 19 Share Posted March 19 If you have the value you could do this I think _WD_ElementOptionSelect($sSession, $_WD_LOCATOR_ByXPath, "//*[@id='MyID']/ul/li[contains(.,'My Selection Value')]") Saludos SOLVE-SMART 1 Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
SOLVE-SMART Posted March 19 Share Posted March 19 Hi @CaptainBeardsEyesBeard, could you share a bit of the DOM (reachable by the Browser DevTools as you surely know). It's not necessary to show us the website, but at least a snippet to test and suggest proper answers would be fine. The answer of @Danyfirex is one good way of doing it, but depending on how your website structure (DOM) looks like there could be more matchable ways or something. Best regards Sven Stay innovative! 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) Link to comment Share on other sites More sharing options...
Danyfirex Posted March 19 Share Posted March 19 @SOLVE-SMART You're right I just share a way to because he did not share element html. Saludos SOLVE-SMART 1 Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
CaptainBeardsEyesBeard Posted March 20 Author Share Posted March 20 (edited) 21 hours ago, Danyfirex said: If you have the value you could do this I think _WD_ElementOptionSelect($sSession, $_WD_LOCATOR_ByXPath, "//*[@id='MyID']/ul/li[contains(.,'My Selection Value')]") Saludos Thanks, I tried this _WD_ElementOptionSelect($sSession, $_WD_LOCATOR_ByXPath, '//*[@id="type"]/div/div[1][contains(.,"Male")]') Now get below in terminal _WD_FindElement ==> No match [8] : Parameters: Strategy=xpath Selector=//*[@id="type"]/div/div[1][contains(.,"Male")] StartNodeID= Multiple=Default ShadowRoot=Default _WD_ElementOptionSelect ==> No match [8] : Parameters: Strategy=xpath Selector=//*[@id="type"]/div/div[1][contains(.,"Male")] StartElement=Default Here's the HTML bit below Edited March 20 by CaptainBeardsEyesBeard Link to comment Share on other sites More sharing options...
Danyfirex Posted March 20 Share Posted March 20 PM me the whole page saved as html. It would be easier. Saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
SOLVE-SMART Posted March 20 Share Posted March 20 (edited) Just as a hint @CaptainBeardsEyesBeard, you can copy parts of the DOM and paste it here (as text). Then we are able to manipulate any website to have your DOM snippet in it and could properly test the XPath and the _WD_* functions. But I am sure @Danyfirex can help you in case you follow his/her suggestion 😀 . And by the way: Your XPath and your DOM snippet image does not match at all (as far as I can see). No @id="type" visible in the image, no "Male" text visible in the image. That's why I suggest to post a wider DOM snippet as text (html), like Danyfirex said before. Best regards Sven Edited March 20 by SOLVE-SMART Stay innovative! 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) Link to comment Share on other sites More sharing options...
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