How to catch a View with dinamic Tag by Espresso/Kotlin in Android? - kotlin

I have a button with a tag value. Tag Value = "fix string" + int. I need to see if the button is displayed and then save the value and click on it.
onView(withTagValue(`is`("^fixString".toRegex()))).check(matches(isDisplayed())).perform(save value)
onView(withTagValue(`is`("^fixString".toRegex()))).check(matches(isDisplayed())).perform(click())
The code doesn't find any view. I think the regex is ignored and I don't know how to save the value.
Any idea?

Related

Kendo-Vue Hide button in column?

i'm struggling with this one, i need to hide a button, i mean a command button based on the value of a column.
i grab the following example from kendo pages, i would like to show/hide the button "View Details" based on the "Discontinued" value.
i've already tested with :visible or :hide properties without success.
https://stackblitz.com/edit/e1fre3
does someone know how to get this working?
The command option is expecting string or array so this is an updated stackblitz example that worked at my side - https://stackblitz.com/edit/e1fre3-wnzfer?file=index.html

odoo button definition not working before setting value to a mandatory field

I have a button say 'calc_val' when I click on the button I had to pass values to a mandatory field.But my button definition is not working while the mandatory field is empty.Only if I put some values to the mandatory field and after when I click on the button , the button works.The whole thing is in a 'wizard'
Please help.Thanks in advance.
Because in odoo after clicking on any button create or write function called before executing the working function of your button and for create and write you have to fill mandatory fields thats why you have to fill mandatory fields before executing any button functionality.
Hello, vbt
You have to set some default value in that specific field.
After set default value, you can use that button behavior.
And if you want to change that value, they can change also.
May Help this answer.
Thank you.
I have done this by removing the mandatory field and then adding a validation while clicking on the final button in the wizard (For not keeping the mandatory field empty).
If any other answers are available,feel free to post.Thanks

I have selected a radio button and I need to double check that its actually selected in the Robot framework

My page is having multiple Radio buttons and I have selected one of them. Now I need to double check whether its actually got selected and if its True I would like to drive my flow accordingly. Here is how I tried using the Robot Framework
Click Element //*[text()=' Small' ] //*[#name='size']
Radio Button Should Be Set To xpath=(//*[text()=' Small' ] //*[#name='size']) true
I am not sure about the things I specified in the second line. Is this correct
This should do it:
Radio Button Should Be Set To size true
The argument to provide to Radio Button Should Be Set To is not an xpath or other locator, but the group's name.
What the framework does with the argument is to substitute it in this xpath:
xpath://input[#type='radio' and #name='%s']
, get all matching elements, iterate thorough them to find the selected one and assert - case sensitively! - its value is the same as your second argument.
And now you see why your call failed - having provided a full xpath, after the substitution it ended up as invalid/not matched expression and the keyword failed.

VB.NET add text to the front of text

I am trying to add text to current text that is in a textbox using a checkbox. Once the checkbox is checked, it will "add" the text to the textbox before the text already in the textbox.
example:
if the textbox said "Jake", it would say "Hello Jake" once the checkbox was checked.
EDIT: sorry for the quick question. I'm in a hurry. But the only method I could think of was concatenating and appending text. As far as I know append() adds only to the end, and concatening isn't the logical approach. I don't have a coded example because I dont even know how to approach this issue. thanks.
It's getting a thumbs down because its so simple, but not. I'm using multiple checkboxes. So one needs to be in the very front, one in the center, etc. Each checkbox injects text into the textbox a certain way. I can do this with nested if statements, but then we got a mess.
Try using this code :
if chbHello.Checked then
txtName.Text = chbHello.Text + " " + txtName.Text
Note : if the checkbox is the trigger put this code in the checkbox.
All it does is see if the checkbox was checked or not.
When its checked just concatenate the text of the textbox and the checkbox with the
checkbox first.

Selenium, using xpath to click a button with a similar content

I want to click a button that contains "Add" as text.
ie:
driver.find_element_by_xpath("(//a[contains(text(),'Add')])").click()
however it's not practical to do this:
driver.find_element_by_xpath("(//a[contains(text(),'Add')])[1]").click()
It would be fine, except the page has a button with text "Add User", and it clicks that instead. Is there a way to only click it if it is EXACTLY "Add" and not just contains "Add"?
You can also try :
driver.find_element_by_link_text("Add").click()
link text will match links who's text equals Add and it doesn't match text which contains Add as part of it.
This should work for you:
driver.find_element_by_xpath("//a[text()='Add']").click()
You should change your xpath to require an exact match instead of a partial match.
driver.find_element_by_xpath("//a[text()='Add']").click()
Using text()= requires the text on the button to be equal to 'Add' and will not find other buttons that happen to contain the text 'Add'