I am writing a set of tests to perform equivalency of web pages. The only differences (declaratively in the test) are the URLs. I'd like to do this by somehow performing multiple store text commands prior to a test so that I can use the stored properties later within the testpage. Is there a clean way to do this?
old properties file
login.page=Login.jsp
new properties file
login.page=/new/Login
And the tests looks like:
.. do some storetexts ..
open | /mypagehome/${login.page}
Sorry to clarify: I have 2 selenium tests for each page. These two tests are exactly the same with the exception of the url. One test the old site , one test the new one. Id like to only have one test and be able to point it to different instances of the site, i cant just use the 'base url' because the urls for both sites are significantly different. How do i get round this problem?
Ok, I think I understand now! :-)
Selenium lets you open absolute URLs instead of just URLs that are relative to the base URL, so you could use something like this:
open | http://somedomain/mypage/${loginpage}
Related
How to fetch query parameter from intermediate redirect URL when you land on final URL in selenium.
I need to test whether a certain query param exists in one of the intermediate redirect URLs that are hit before finally I land on a final destination URL in selenium tests. Is there any easy way to pull the redirect URLs or maybe save them as a list?Example redirects
Like Nandan suggested, your best option is to capture network logs or use a different tool.
Selenium attempts to interact with the browser the same way an end-user would. Since an end-user is unlikely to care (or even notice) an intermediate URL, Selenium doesn't really offer a reliable way to check the query params.
When transitioning between pages, in most cases Selenium waits for the page to be fully loaded before it allows your code to interact with it. This means that it's unlikely anything you do try to grab the param (like checking the page URL) will be unsuccessful.
Something you could try is using Selenium's Javascript Executor to check the referrer. This might not work; Some pages disable or edit it. But it's worth a shot.
Wait until your final page is loaded, then use the execute_script method (or it's equivalent for your Selenium bindings) to grab the referrer:
driver.execute_script "return document.referrer"
Then, use String methods to find your query param.
Is it possible to loop through a list of words in R that can each be generated into separate “speech” files using the speech2text website?
https://www.text2speech.org/
To make one file manually one has to type in the text one one page then submit it. A second page then opens with the option to download the file. Since I want to do many of these I would like to find a way to automate it. I have no idea how to approach this idea though.
EDIT
So I am using "say" on mac based on a the helpful comments. I am running it through R using a loop for all strings in a vector
for(i in 1:nrow(test[1:5])){
system("say", intern =F,input = test$English[i])%>%saveRDS(paste0("/Users/Desktop/tts/", test$English[i],".aiff"))
}
This creates the files as expected in the expected location but the .aiff files won't play in any media player. Does anyone see what I am doing wrong?
Consider using a CLI based solution for TTS, like espeak/espeak-ng (cross-platform), festival (linux), say (osx) or via powershell on windows (here's a script). Looks like the page you're referencing is using flite, which is a lightweight (and downloadable) version of festival.
I want to test a page.Where i want to fill up the fields like first name last name etc.and after going two pages further if i come back to the original page by using back navigation ,data entered for first name and last name remains the same.or it is filled up.
In jmeter i want to check the same if data entered for the fields remain same if i navigate back .
How can i achieve this.
I tried gving url directly in the path its not happening since it is not the way.
please help me since i'm new to jmeter.
You need to understand 2 things. How JMeter works and how your application works.
JMeter only captures data that is communicated to server. It does not matter how data is entered from UI. It does not check if data retains in the fields or not. It only records the request that is sent by your application to server-side.
So, if you understand above, you also need to understand how your application sends data to server. Does it sends the request as you move from first page to second. Or does it send (Submit) data on final page.
Either way, JMeter is not a tool to test if your form fields are retaining data in them as you navigate between pages. As mentioned earlier it only monitors data requests/responses.
Selenium seems a better option for your test requirement.
Please read the apache documentation carefully:
JMeter is not a browser. As far as web-services and remote services are concerned, JMeter looks like a browser (or rather, multiple browsers); however JMeter does not perform all the actions supported by browsers. In particular, JMeter does not execute the Javascript found in HTML pages. Nor does it render the HTML pages as a browser does (it's possible to view the response as HTML etc., but the timings are not included in any samples, and only one sample in one thread is ever viewed at a time).
First, you have to understand how JMeter works!!! To do the Functional Testing, Selenium would be a good choice.
Thanks
So I have hit a bit of a snag. I am trying to automate a test case where I need to pass multiple files to an input node and I cannot figure out how to do so. I can use either Mechanize or Watir, but have found very little information on a topic that seems relatively major in automation. In the snippets below, I'm using Watir with Ruby. The main issue I'm having is that it seems when multiple files are selected, the input node is no longer visible. The input node does accept multiple files, and passing in a single path does result in a successful upload, like so.
path1 = "/path/to/file.json"
file_field.set path1
I would think that passing in multiple files would be as simple as passing in a string with multiple paths separated by some sort of delimiter. I'm not particularly savvy with web dev however, and am struggling to grasp where I should even start. When I attempt to pass in multiple files like so:
multiple_paths = ("/path/to/file1.json"; "/path/to/file2.json")
file_field.set multiple_paths
it gives uploads the second file but not the first (making me think maybe it's uploading them in sequence, and the second is overwriting).
Do you think this is even possible using Watir? I know that Chrome has a workaround for uploading multiple files using \n as the delimiter, is there a similar workaround for Firefox?
Currently there doesn't seem to be a workaround for Firefox. If anybody knows of one, please post the answer as I couldn't find a solution anywhere. I figured I'd post the solution for Chrome here because resources are scarce on this.
If you need to test for multiple file uploads, have that particular instance load the Chrome driver with:
#browser = Watir::Browser.new :chrome, :prefs => profile
Then you're going to want to pass it a string that looks something like this:
paths = "path/to/first/file.json\npath/to/second/file.json\n...etc
file_field.send_keys paths
When I look at many large sites (e.g. wikipedia or this site) the urls looks like this:
http://en.wikipedia.org/wiki/StackOverflow
And not like:
http://en.wikipedia.org/wiki.php?article=StackOverflow
http://en.wikipedia.org/wiki.pl?article=StackOverflow
... or even
http://en.wikipedia.org/wiki?article=StackOverflow
I suppose that wikipedia does not create a separate file for every article (and then use apache modules like mod_rewrite to hide the file extensions).
But how do they do this? Are they using a special server? Is there a way to configure apache to act like this? For example one script is called by every request and the path of the request is transmitted to the script, which will decide what to print.
These are called Friendly or Clean Urls .
Have a look at
http://en.wikipedia.org/wiki/Rewrite_engine
http://en.wikipedia.org/wiki/Clean_URL
http://www.petefreitag.com/item/503.cfm