SeleniumWebdriver_How To select particular link when from search results - selenium-webdriver

Am new in selenium webdriver & right now I'm struggling at one point for that I need some guidelines. I'm searching employee records in search results &for require employee record I have set excel sheet for input purpose so I'm able to do that successfully but now the issue is that when a search returns me the require results I'm not able to click on that record can someone suggest me what I'm doing wrong .
I have designed below code for that driver.findElement(By.cssSelector("#txtSearchKeyword")).sendKeys(Sheet.getCell(3, i).getContents());
driver.findElement(By.name("")).click();
driver.findElement(By.xpath("(//input[#type='button'])[8]")).click();
so per above script I'm able to search employee records by providing input from excel sheet but not able to click that records to move forward. any suggestion on these will really appreciated.

#Amit once you click on search give some wait condition and then click on the link which you are expecting. because the code gets executed line by line while the page loads it is searching for the link to click , so give some wait until you see the link and then click on the link.

Related

OpenQA.Selenium.WebDriverTimeoutException : Timed out after 10 seconds

This is my feature file
Given site is opened
Then I Close the modal
Then Find your restaurant page displays
When I select a restaurant name
Then The selected restaurant page displays
When I click "Go" button
I’m totally new to automation testing with bdd using selenium webdriver. I wanted to book a table in a restaurant .When I execute my project I see only first three steps other steps not working and Not selecting the restaurant as well. To select a restaurant I have used SelectByIndex(3) method. I get the below error. Could anyone please help me to rectify this issue?
This is the code I have given in my WebDriverExtensions.cs file
https://i.stack.imgur.com/KflLp.png
enter image description here
I wanted to book a table in a restaurant
The first issue here is one of clarity; Your question omits the code you're using (you mention the method but don't demonstrate it's use), there's no logical Then statement to Assert the end result, and the order of your BDD scenarios is generally unclear.
Due to the lack of information, I can only suggest a change to your BDD scenario syntax to improve the readability of your test. If you want help with the error, I would suggest adding your code in full to the comments or amend your question (please use StackOverflow's formatting tools).
Test Readability - Good Practice:
It's good practice to keep tests short and snappy, in both execution and for readability. Well structured scenarios should ideally have one Given, followed by one When followed by one Then, usually in that order. You can also make use of And and But.
E.g.
Given this is where we start
When I do a thing
Then this is the outcome
Here's your scenario:
Given site is opened
Then I Close the modal [enter image description here][1]
Then Find your restaurant page displays
When I select a restaurant name
Then The selected restaurant page displays
When I click "Go" button
There's a lot of set-up there so it'd benefit from a shared background, and there's no ending Then statement. How you could re-structure it:
Background:
Given the site is open
And the modal has been closed
And the Find your Restaurant page is displayed
Scenario: I can book a table
When I select a restaurant name
And the selected restaurant page displays
When I book a table
Then the success page is displayed
Assuming you're using a SpecFlow / Page Object Model approach, each of those steps creates a Step Definition which, in turn, look at the methods to complete each step. The background can also be used for any other test in the same feature file beginning at the Find your Restaurant page, so you don't need to duplicate those lines.
You could further condense it for readability and just include the necessary methods in fewer step definitions:
Scenario: I can book a table
When I select a restaurant name
And I book a table at a selected restaurant
Then the success page is displayed
If you add comments to your Assertions, you'll still know at what point the test fails.
Making your tests readable, short and snappy will mean you can maintain them better down the line.
Best of luck.

How to show variable's value in Dialog Name (Einstein Bot)

I need to show the Product's Name in the Menu, I think image says it all:
Click here to see the image
I have a menu, with two options, and the first show a text with a variable, but {!Product} don't works, there is a way of this work?
When I put {!Product} in Message or Question, this works normal...
I didn't find any solution for showing the variable in the title dialog, my solution was to change the message to "Know more about this product", I left a generic message.
Old topic but the answer might help someone.
There's a great article explaining how to get some dynamic information https://www.infallibletechie.com/2021/11/how-to-create-case-from-einstein-bot.html
In your case, I guess you need to
Query your products (the out-of-the-box Einstein Bot query is simple and has a limit of 3 items but you could call a flow or apex to get better granularity on the filter/logic and control le size)
Store the query result in a Custom record list Variable
Query data with a flow
Use a dynamic question and merge fields to display what you want
Top configuration of the dynamic question
Down configuration of the dynamic question

Java FX database problem when adding new datas

I have a database problem. I want to create a simple Java FXML application which could help to my friend to search the protein/potassium content of the foods, because of kidney disease.
I have 4 class variables: name, protein, potassium, and id for the database (to identify the variables in the database).
I use Java DB - derby.
My application has 2 pane: 1. „home screen” has a textfield, where you have to type the name of the food you looking for, and if you click to the „search” button it will search the appropriate data from the database and show it in a table on the next pane. (the searching isn't working yet – you can type anything in the textfield what you want and then click to "Search", but no results showed yet in the table).
On the next page you can see the table, and at the bottom, you can add new data. I did a test to make sure the database works correctly, so the second pane I wrote a test Name, test Protein content, test Potassium content, and then click to the „add” button. Then the table shows just the potassium value, and puts this value in the first column instead of the „potassium column”. By the way, the db works but just stores the last value in the first column. I think I have a mistake somewhere in the setTableData method, but I run out of the ideas.
Here is my link to my files: https://github.com/Capkit/FirstProjects
I would be very grateful if somebody could help me!

Automate daily collection of weather station data from NCDc

Here is the link to where the data can be found. Scrolling down to Surface Data : Daily and selecting the Global and U. S. Web Page Icon. On the next page, Select the radio button Country and press continue. From the next page's drop down menu, select any state and then press the radio button for entire state (I need more than 100 stations per day).
The next page allows you to select the date range.
I am dumping these data files into excel and sorting (which is a pain, since it could obviously be
automated).
Is there a way I can access the most current data via a script (VBA or otherwise)?
My main problem is that I can't send the server a simple request to obtain the data. Also, there is an FTP site but only allows .gz files to be downloaded, each over a gig, so its not reasonable for my situation.
Any help would be appreciated!
There National Climatic Data Center has several data APIs available for this.

Report Builder 2.0 Create a dataset with Parameters

I cannot get my dataset to recognise a parameter supplied to it.
I have created a report parameter "ProjectID".
(In Report Parameter Properties, Name="ProjectID", Prompt="ProjectID").
In Dataset Properties|Parameters, Parameter Name="ID", Parameter Value="[#ProjectID]".
When I click on the Filter button in Query Designer, the "Projects with" panel says:
"? ID equals (unspecified)".
But when I run the query I'm not prompted to enter a parameter value, and multiple rows are returned.
I should stress that I'm simply trying to replicate the functionality of a pre-existing report where all this works exactly as expected.
When I diff the rdl files of the two reports there are obvious differences, and I can hack the xml (of the semantic query) so that it works, but I don't really have the understanding of why it's working, or how to replicate the necessary changes via the GUI.
Can someone please give me some pointers - preferably without referring me to the documentation as I've been through this numerous times as well!!
Thanks in advance,
Peter.
p.s. I can post some of the rdl differences if that will help, but wanted to keep my initial post clear and to the point.
OK, so what you need to do is when in the Filter screen of the Query designer, assuming you've already specified a filter in the main pane, such as:
"ID equals (unspecified)"
You need to click on "ID" and a context menu appears with "Edit as Formula", "Prompt" and "Remove Condition".
Select "Prompt", and there you go.

Resources