TestProject Forum

Date selection without calender

There is a scenario in which I want to select any date and click on it.There is no calender.There are dates from last 4 days mentioned on the page.I want to pass date as parameter and click on it.But I dont know how to pass date and how do I click on it.KIndly help.
Do I need to pass Xpath of date from csv file? is there any other way?
Android mobile testing

Hello @tanvi.lohakare,

Following your previous question on how to pass the date value using a CSV file

You can create a step that performs a “Click” action and integrate the date parameter in the locator of the dynamic element you want to click on, for example,

using the following XPath: //*[@text=“​{Element_Text}”]​ the element will be captured by its text.

  • Create an element, set its locator to the above XPath, insert the date parameter as the text value

  • Create a step manually, set the element to the one you just created, set the action to be a “Click”

This way, you can click on the dates dynamically according to the CSV values.

How do I create dynamic xpath in andoid?
Also,the dates are displayed such as clickable fields as follows:
17-Jan 18-Jan 19-Jan 20-Jan

I want to click on the date but I want to send date as parameter from csv…how do I pass date values dynamically?

I want to test it on different dates

Hey @tanvi.lohakare,

Exactly as explained above, here is how you can do it step by step:

  • Create a parameter that will store the date value, let’s call it “DateFromCSV”, and its default value will be “17-Jan” (the default value will be overridden by the CSV values at run time)

  • Create a step manually > click on “Select Element” to create a new element > click on the plus button, then, you will be able to define the new element. set its XPath to //*[@text=’{Data_Parameter}’] integrated with the date parameter you created in the first step​

This way, the element will be captured by its text (which stored in the parameter and will be overridden by the CSV file).

Now, you can generate a CSV file from this test, and add the required values (the dates).

  • Navigate to your test > click on the 3 dots > click “Datasource Template”
    image

  • The data source will be downloaded locally to your machine, open it and add the date values under the “DateFromCSV” column

image

  • Once you have added the data that you want you can save the file as a .csv file again and upload it back into the TestProject app. To do that, go to the Data Sources menu option and choose to Add a data file.

image

  • Last step will be to assign the CSV file to the test, click on the run button to run your test > click next > select the “Use data source” option > click on the required data source from the dropdown
    image

  • Click Run

The test will run once for each row that you have added in the .csv file using the input for that row, the click step will click on the date according to the CSV file values.

Feel free to reach out through the TestProject chat if you’d need any further assistance.