My page has a <th> tag that has "attendance" as its CSS class. The following Cucumber step fails:
Then I should see "Name" within "th"
while this one passes:
Then I should see "Name" within "th.attendance"
Do I really have to use this level of specificity? I feel like, for Cucumber, that's requiring too much knowledge of the underlying code being tested and it should be a bit more generic.
In other words, how would I say "Just find '[value]' within any 'th' tag"? And am I wrong for wanting to do so?
Try the following. It finds the given text within the given selector, using xpath.
"//#{selector}" means that it should find tag that matches the selector.
"[contains(text(),'#{text}']" means that the tag text should contain the given text.
Then /^I should see "([^"]*)" within "([^"]*)"$/ do |text, selector|
find(:xpath, "//#{selector}[contains(text(),'#{text}')]").should_not(be_nil, "Could not find the text '#{text}' within the selector '#{selector}'")
end
Related
I would like to add some placeholder text to assist the signer with what type of data they should populate. Although a nearby label is the main source of assistance/guidance, I was hoping to add some placeholder text as well. Looking through the documentation for Text I do not see such such an attribute. So if the Text class does not support 'placeholder text', is the next best thing the usage of tooltip argument?
Goal:
There's not exact equivalent feature. You can do these things, but none is exactly what you asked about:
You can set the initial value of the text tab. This would not require the user to modify it and would not immediately be removed when they focus on that tab.
You can use a tooltip like you mentioned.
You can use a label like you mentioned.
In addition, you can use various validation rules to ensure user filled the tab correctly.
I am trying to understand how to structure intents when entities contains the same strings as value.
I imagine that when adding functionalities this will become a mess;
What is the correct approach to handle this "mixed" content?
example:
Entity 1: content
word document(s)
html page(s)
video(s)
Entity 2: content-specifier
video(s)
image(s)
car(s)
Example 1: show me all [html pages] with [videos]
the expectation is to have
#content => "html page"
#content-specifier => "video"
Example 2: show me all [videos] with [cars]
the expectation is to have
#content => "video"
#content-specifier => "car"
I believe that at the beginning you're going to get a lot of false positive matches. After training and adding a lot of training phrases there it should be ok though. To help it match better the options use also a template:
3 things to note here:
make sure you correct at your intent any values it misclassified
go at the training option frequently and make sure that the entities are correctly recognize. Make any necessary changes
Create a template for the user input. To do so, in your intent at the training phrases, click on the quotes. It will change to an "at" symbol (#). Then add the expected format of your user's input
I am a Blue Prism novice and need help!
I am searching on some key terms in Google - when the first page results open, I want to have Blue Prism pick out the link titles which have "Key Term 1" and "Key Term 2" in the titles, then open the links. Meaning that, there could be a handful of results in the Google search results which may (or may not) contain the 2 Key Terms.
Is there any way I can do this in Blue Prism?
Yes, many different ways in fact.
Basic Solution:
First
Have the bot pass "Key Term 1" and "Key Term 2" into the Google search input box proceed by "allintitle:" and linked together with "AND". This will tell Google to only return results with "Key Term 1" and "Key Term 2" in the title.
The search will then look like this: allintitle: "Key Term 1" AND "Key Term 2" (Image Example)
This basically makes Google do the title work and saves you from having to grab the returned page and do a string value comparison between the titles and your key terms.
Second
Spy the appropriate on-page HTML location for the returned links in your Google Search objects Application Model.
The links themselves are held in the <cite class="iUh30">{URL}</cite> HTML element, so your Application Model element will look something like this:
Tag - 'Equals' - CITE
Class - 'Equals' - iUh30
Index - 'Dynamic' -
Third
You can then pass in the number value of the index of the link you want the bot to click on in a Navigate stage. Should this be more than one just have the bot loop over the Navigate stage, but simply add 1 to the current index number before the end of the loop. In order for this to work you will have to setup your bot resources browser options to open links in a new tab, otherwise this will not work.
Another strategy you could pursue would be to have the bot grab the Google search return pages entire HTML and store it in a Data Item. You could then use the XML VBO to parse out everything but the returned links and then do with them as you please.
Grabbing the whole DOM and pulling it into Blue Prism is inadvisable though, as it's always bad practice to introduce the possibility of unknown live scripts being pulled in as well.
For example, if my page contains the following code:
<a id="foo" href="#">Click Me!</a>
Is there a way with CodedUI to verify that a link with id equal to "foo" is present on the webpage?
Inspect the link with the Coded IU cross-hairs (ie assertion building) tool. The properties shown should include the Id field. You can then generate an assertion that the link contains the text Click Me!. Make sure the generated search properties include the required value for the link property. If the Id field or the displayed text are variable (perhaps their values are data driven or found earlier in the test) then before finding the control (implicitly or explicitly) set the required values. This should work because the assertion can only be checked if the required field is found on the screen and that find uses teh Id field.
Perhaps your question is a more general "is there such a link anywhere on the web page"? If so then you can use the GetChilden() to do a recursive traverse of the web page. Check each UI Control found to see if it has the desired values.
The Twist documentation for extracting concepts shows how multiple steps can be grouped into one step that contains those steps. For instance, the following eight fixtures
1. Start at the Maintain product catalog page.
2. The page title should be “Joe’s musical —Maintain Product Catalog.”
3. Click the Add New Instrument button.
4. The page title should be “Joe’s musical—Add New Musical Instrument.”
5. Enter text “Guitar” into the Instrument field.
6. Select “Slide” from the Type selection list.
7. Select “Dobro” from the Brand selection list.
8. Click the Save button.
Can be condensed into one concept:
1. Add a New Musical Instrument “Guitar” of type “Slide” and brand “Dobro”
However, the tutorial doesn't say if it's possible to use this concept with other parameters (perhaps with "Drum" instead of "Guitar"). However, it does clearly say that parameters in the concept name should be surrounded by quotes, but they also should match the parameter name, so it's not clear if it's possible.
So can I use parameters with Twist concepts?
Yes! The documentation is really crummy about making this clear, but it is absolutely possible.
If you extracted a concept in the way that they described in the tutorial you referenced and others, then the fixture Add a New Musical Instrument “Guitar” of type “Slide” and brand “Dobro” actually contains three parameters named Guitar, Slide, and Dobro. What makes this so confusing is in each scenario you can change the value of each parameter to whatever you like (perhaps "Drum", "Snare", "Yamaha"), but under the hood, the variables are still called by their original names (thus Guitar=Drum, etc.) and these original names will appear as default values whenever you add the concept to a scenario.
To eliminate confusion, I recommend changing these default names. In this case, it might be Add a New Musical Instrument “Instrument” of type “Type” and brand “Brand”. Bizarrely, you can't rename the parameters via "Rephrase the Open Concept" because you run into a catch-22 situation. You can't change the name of the concept because it doesn't match the usage in the fixture. And you can't rename the fixtures because the parameters are bound to the concept name. So I recommend just opening it up in the text editor and making the change there.
So bottom line, the examples make it seem like you can't use parameters because the parameters wind up being named after whatever value you inputted. I recommend changing the default parameter names, but you have to do it in the text editor because Twist won't let you.