How to check table results on multiple pages using selenium - selenium

I am trying to use selenium to check that a table on the page has a particular string.
I am trying to use "Table Should Contain". Does this check all the pages of result or only the results displayed on the current page?

1) You can use isElementPresent() or isVisible() functions
2) You can get the css for the entire table and do a search for the particular string you're searching for.
Option 2 tends to be faster, but I don't know how the table on the page works, so the string might be in the css selector even though its not actually displayed on the page.

Related

How to click on a link in a specific row of dynamically loaded table

I have a table similar to below in a WPF application.
We are using Silk Test 17.5 using VB.NET.
Table is dynamically loaded based on latest data.
I need to click on 'Default' ( Link) for specific row.
e.g. I need to click on 'Default' link for Trump1 , Trump2 row.
How should I do it? All locators of default links are same and I cannot differentiate between them.
Is there any I can append First Name locator to Default to figure out which locator to click?
Tokci
SilkTest has a framework for supporting such custom controls and a nice tutorial here
Theoretically you would have to:
List all the methods on the control
From the previous listing (or by talking with the developers) look up the method to access the rows inside the control
Filter your rows and get the one which is interesting for you
From the row you can get the cell by following the same pattern(find out the method which gives acces to it, get it, filter)
Click on the Link
Of course as the tutorial tells you, if you do not want to always do these iterations you should create some higher level utilities where you can just get the Cell at once. Example: GetGridViewRowCell(gridView, cellRow, cellColumn) where cellRows can be a more sophisticated filter object where you describe which cell must have which value in order to identify the proper row
Assuming the table has a hierarchical structure similar to HTML, you should be able to do the following:
Locate a cell in the row you are looking for that is easy to find, e.g. //WPFDataGridCell[#text='Obama'].
From that cell, move up the hierarchy one step using ...
Now you're in the correct WPFDataGridRow, search down again for the row's "Default" link with //WPFHyperLink[#caption='Default'].
Putting it all together, you'll get a locator like //WPFDataGridCell[#text='Obama']/..//WPFHyperLink[#caption='Default'].
Of course this is only an example based on the information you provided, so if you try it, make sure to pick the attributes with Silk Test's locator spy to make sure you get the correct values.

Create multi-page document from a single page template using doc4j

I am planning to use doc4j for search and replace in a template. I'do like to create the page for each member in the list. Basically, I need to replicate the same page from the template. I have done simple search and replace. However, this little complex one for which I need some sample examples. Here is my requirement:
I have a docx template which has the content with place holders.
There is a table with 3 columns in it and I need to replace with different values for each column like first name, last name and etc. The number of rows may vary anywhere from one to 200. So technically this may go beyond one page. If it exceeds more than one page, then I need the table header to repeat in the next page too.
I want to copy the same template on every page and replace the place holder. Basically create a single document with multiple pages each page for one member.
Please provide me with the example.
Appreciate the help.
Thanks.

Multiple URL Queries including Text Fields and Dropdown List

I have to perform a search based on 3 queries in a single URL and so far i have achieved this
...Search.aspx?StartDate=1/9/2015&EndDate=1/9/2015
the third query which i want to include in the above URL is related to a Drop-Down List containing 100 plus options.
code
How should i write the URL to get the required option.
Why can't you do something like Search.aspx?StartDate=xx&StopDate=YY&options=selected1,selected2,selected3 ?

How to filter a Sharepoint List Column with a Textbox Control Value using a "Contains" query?

I'm using a data view to display a list (Sharepoint 2010) that has several columns including one that has a Name column. I've provided the user with a text filter on the page to send values to filter the Name column in this list. The problem I'm facing is that the filter only works for exact matches and not partial matches.
I tried to overcome this problem by using Sharepoint Designer to:
create a parameter that uses the textbox control value.
Filtering the Name column with this parameter and setting the comparison to "Contains"
Unfortunately if the default value of the Parameter is blank, the list does not display any data. If the default value of the parameter is set to part of a name in the list, the list displays names that contain that string. However, when changing the value in the text box and searching, the list does not return results. Please let me know if you guys know how to fix this. Any help is much appreciated and let me know if you need any additional information. Thanks!
Managed to find a solution to my problem. I used a custom javascript solution designed by jvossers (http://instantlistfilter.codeplex.com) that involves the list being filtered instantly much like Google's search!
The only downside of this solution is that it only filters the items currently displayed on the screen. Therefore, if you have a data view web part which limits the amount of items displayed on the page, this solution won't help you. In order to facilitate this solution, display all the row items on the page (by increasing the item limit per page to a larger number than your total list rows) and then add this code into a content editor web part on the same page. Worked brilliantly for me. '
By the way if you are using jQuery 1.3.x or higher, you should modify the script a little as described in the disscussion here: http://instantlistfilter.codeplex.com/Thread/View.aspx?ThreadId=49123

How to display search results in a new form

I've created a system and within that system i've a find/search page and a find/search results page. Basically, the find/search page consists of a number of text fields and the more the user completes, the more efficient the search will be.
I'm using SQL server 2005 to store the data and I can easily update/insert/save new data but I don't know how to search for the data ...
I want the user to fill out the fields in the find/search form and for the results to appear in the find/search results page. Can this be done?
It depends on what kind of Data you need to search.
If it's generic text data the best way is to use Full-Text Search
Yes. There are a number of ways you could achieve this. One possible way would be to pass the search criteria to the search results page via query string. Another way which is very similar is to store the search criteria in a session and redirect to the search results page. In either case on the search results page you'd want to take the data and build your SQL query. Depending on what you need you could utilize a full-text search like Kesty has suggested or you could simply use FIELD like '%user entered data%' in your queries. It really depends on your needs.