Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to select dropdown option use select step? - some examples here on usage #1017

Closed
finnfotoer opened this issue Apr 18, 2021 · 3 comments
Assignees
Labels

Comments

@finnfotoer
Copy link

finnfotoer commented Apr 18, 2021

Very enjoy TagUI ,bu i am newbie to use Tagui :(
When using the "select" instruction, I found that the dropdown options cannot be selected to the options I specified
For example :
This is my localhttpserver index.html code
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="x-ua-compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Title</title> </head> <body> <div> <form action="http://www.baidu.com" method="get"> <div> <!-- dropdown --> <select name="sel"> <option value="1">GZ</option> <option value="2">SZ</option> <option value="3">SD</option> <option value="4">BJ</option> </select> </div> <input type="submit" value="GO"> </form> </div> </body> </html>

I want to change the drop-down options from "GZ" to "SZ" using the select method.
My code is
http://127.0.0.1 click /html/body/div/form/div/select select /html/body/div/form/div/select/option as 2
or
http://127.0.0.1 click /html/body/div/form/div/select select /html/body/div/form/div/select/option[2] as 2
or
http://127.0.0.1 click /html/body/div/form/div/select select SZ as 2

I fllowed this post(#305).
But all the above methods cannot change the drop-down option to SZ.
Why?So what is the correct way?
Plz help me ,Thx a lot!

@kensoh
Copy link
Member

kensoh commented Apr 19, 2021

Hi @finnfotoer I think why your examples did not work is because you are performing select on the option. The first parameter for select is the dropdown thing but not the actual option. Can you try if any of below works?

http://127.0.0.1
select sel as 2
http://127.0.0.1
select //*[@name="sel"] as 2

Adding on, recently we add the ability to also select by text of the option instead of only value. So value or text both work.

If you want to select by text, you can get the updated version here - #1001 (comment) and below should also work.

http://127.0.0.1
select sel as SZ
http://127.0.0.1
select //*[@name="sel"] as SZ

@kensoh kensoh changed the title Unable to Select dropdown option use select setp? Unable to select dropdown option use select step? - some examples here on usage Apr 19, 2021
@kensoh kensoh added the query label Apr 19, 2021
@kensoh kensoh self-assigned this Apr 19, 2021
@finnfotoer
Copy link
Author

Thx a lot for your help .Would like to ask how to use TAGUI in python to click a button without using the click method and directly use the post method instead of the click method?

@kensoh
Copy link
Member

kensoh commented Apr 20, 2021

Hi @finnfotoer are you referring to the RPA for Python tool? - https://github.com/tebelorg/RPA-Python

Can you tell me more what you mean by post method? I have not come across this question before. Normally UI interactions are done directly using the different functions, and in some cases using dom step or dom() will be useful to run code directly within the web browser program space.

@kensoh kensoh closed this as completed Apr 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants