Looking for way to select a dropdown option with selenium wrapper in VBA

I have the following html that I want to select "Orders"
<select id="saved_queries" onchange="change_qb_export_filetype();ProcessFieldUsage(this)" name="QB_ID">
                    <option value="8" data-filetype=""></option>
<option value="3" data-filetype="CSV">AllCategories</option>
<option value="4" data-filetype="CSV">AllCustExport</option>
<option value="7" data-filetype="CSV">MasterProductExport</option>
<option value="10" data-filetype="CSV">OrderDetails</option>
<option value="9" data-filetype="CSV">Orders</option>
<option value="6" data-filetype="CSV">ProductEx1</option>
</select>

Open in new window


When I run the firebug from Firefox, it gives me the following when I record the macro
 ' ERROR: Caught exception [TypeError: value.replace is not a function]

How would I select option "Orders" value 9 using selenium wrapper?
BrujAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ThommyCommented:
You can do that in 2 ways:

1.)  driver.findElementByCssSelector("selector").AsSelect.selectByText "Orders"
2.)  driver.Select "css=selector", "label=Orders"

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
BrujAuthor Commented:
When I try, either one, I do get an error."No such element"
I have used "selector", I have tried the ID and the name.

Public Sub untitled()
  Dim driver As New SeleniumWrapper.WebDriver
  Dim By As New By, Assert As New Assert, Verify As New Verify, Waiter As New Waiter
  driver.addArgument "test-type"
  driver.Start "chrome", "http://www.timberturners.com/"
  driver.setImplicitWait 5000

  driver.get "/login.asp"

  driver.findElementByName("email").Clear
  driver.findElementByName("email").SendKeys "sales@timberturners.com"
  driver.findElementByName("password").Clear
  driver.findElementByName("password").SendKeys "password"
  driver.findElementByName("imageField2").Click
  
 ' driver.findElementById("Inventory_ImportExport").Click
driver.get "/admin/db_export.asp?QueryBank=Y"
 ' driver.findElementByLinkText("Saved Exports").Click
 ' driver.findElementByLinkText("Standard Export").Click
  ' ERROR: Caught exception [TypeError: value.replace is not a function]
  'driver.findElementByLinkText("Export").Click
  'driver.findElementById("btnSaveChanges").Click
  'driver.findElementByCssSelector("span.v13-icon-download-primary").Click
'  driver.findElementByCssSelector("saved_queries").AsSelect.selectByValue "9"
  
  '.AsSelect.selectByText "Orders"
   driver.findElementByCssSelector("saved_queries").AsSelect.selectByText "Orders"
  driver.Select "css=selector", "label=Orders"
  'QB_ID
    driver.findElementByCssSelector("QB_ID").AsSelect.selectByText "Orders"

  ' ERROR: Caught exception [TypeError: value.replace is not a function]
 ' driver.findElementByLinkText("Export").Click
 ' driver.findElementById("btnSaveChanges").Click
  driver.findElementByLinkText("Download").Click
  driver.findElementByLinkText("Log out").Click
  driver.findElementByName("password").Clear
  driver.findElementByName("password").SendKeys "password"
  
  driver.stop
End Sub

Open in new window



Thanks!
BrujAuthor Commented:
I tried to use the macro recorder for VBA remote, and it gave me a workable code!
Here is what is working:

  driver.Select "id=saved_queries", "label=Orders"

I hope this helps somebody else!

Cheers and Thanks
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming

From novice to tech pro — start learning today.