Selenium IDE Issue In Export Result - selenium

I have created one function in .JS file, using which I calculate the response time of login functionality, it's working fine, the log is also showing the response time correctly. But when I am exporting the Test result and open it in Firefox, its showing me all the steps as pass but not showing the calculated time. Its only showing the variable in which I store the calculated time not its value whereas the log is displaying them.

You should print the calculated result by using echo command.The variable which is printed by echo function must be like this format:
Command = echo,
Target = ${printedVal}

Related

How to save result from OS Process Sampler to a variable?

JMeter OS Process Sampler is set up, works fine and saves result (a token as result of powershell srcipt execution) to a file.
Is it possible somehow to save result from powershell script directly into a JMeter variable instead?
What should I add for that?
Normally you should be using JMeter Post-Processors in order to extract data from Sampler's responses
If the token is the only thing that your powershell script returns you can extract it using i.e. Boundary Extractor, just provide desired variable name and leave everything else empty
Demo:
If there is some other text surrounding the token - adjust the boundaries accordingly or go for Regular Expression Extractor

How does placing the statement to create an instance of Selenium WebDriver, inside/outside of a function affects find_elements_by_xpath?

Refer the following code:
def parse(height_id):
driver2=webdriver.Firefox()
driver2.get(height_id)
block_details_web_element=driver2.find_element_by_xpath('//*[#id="__next"]/div[3]/div/div[3]/div[1]/div/div')
print (block_details_web_element)
print(block_details_web_element.text)
print(" --- BLOCK PARSED SUCCESSFULLY! ---\n")
driver2.quit()
#the following parts are outside the function:
p = Pool(4)
records = p.map(parse, height_list_on_each_page2) #height_list_on_each_page2 is a list of URLs.
p.terminate()
p.join()
(Eg. of a typical URL: https://www.blockchain.com/btc/block/000000000000000000028e473f1c95060a63100c9861525105b1f5ced81a7fa0 )
Now, this works fine, but takes huge time. So, I planned to put the statement driver2=webdriver.Firefox() outside the parse function, so that I don't re-create the instance of WebDriver each time I'm calling the function. [And I also removed the statement driver2.quit() from this function]. This is saving time, however, almost half of the times the print statment print (block_details_web_element) is returning None as output.
I doubt that the find_elements_by_xpath method is not working correctly. Is this because of multi-processing that I am using?
Any insight, why this is happening? Please suggest a solution.
EDIT : (this is the error)
(https://www.dropbox.com/s/1yvknbdg9wefuwy/selenium.jpeg?dl=0)

Apache Velocity log to console for debugging

Using Apache velocity in xwiki, how do I create a console.log() like one would in JavaScript? I know the log will probably be server side. I really just want to print the values of variables as it is rendered for debugging purposes.
I should add that the page I'm trying to debug is a form .post page, thus not rendered by its self, only returns data. Thus {{velocity output="false"}} mode, so simply printing the variable is not an option.
Since XWiki 6.1 you can use logging script service to get a standard logger:
$services.logging.getLogger('My script').info('Hello {}', 'world')
See http://extensions.xwiki.org/xwiki/bin/view/Extension/Logging+Module#HGetaLoggerfromscript for more details.
I had trouble to figure out what's the value for 'My Script'. Turns out the function getLogger() will take a logger_name as input parameter, where logger_name can be any of the logger name in ..WEB-INF/classes/logback.xml.
For example, this works for me: $services.logging.getLogger('org.xwiki').info('Hello {}', 'world')

Trying to get node-webkit console output formatted on terminal

Fairly new to node-webkit, so I'm still figuring out how everything works...
I have some logging in my app:
console.log("Name: %s", this.name);
It outputs to the browser console as expected:
Name: Foo
But in the invoking terminal, instead I get some fairly ugly output:
[7781:1115/085317:INFO:CONSOLE(43)] ""Name: %s" "Foo"", source: /file/path/to/test.js (43)
The numerical output within the brackets might be useful, but I don't know how to interpret it. The source info is fine. But I'd really like the printed string to be printf-style formatted, rather than shown as individual arguments.
So, is there a way to get stdout to be formatted either differently, or to call a custom output function of some sort so I can output the information I want?
I eventually gave up, and wrapped console.log() with:
log = function() {
console.log(util.format.apply(this, arguments));
}
The actual terminal console output is done via RenderFrameHostImpl::OnAddMessageToConsole in chromium, with the prefix info being generated via LogMessage::Init() in the format:
[pid:MMDD/HHMMSS:severity:filename(line)]
The javascript console.log is implemented in console.cc, via the Log() function. The printf style formatting is being done at a higher level, so that by the time the Log() function (or similar) are called, they are only passed a single string.
It's not a satisfying answer, but a tolerable workaround.
I was looking to create a command line interface to go along side my UI and had a similar problem. Along with not logging the values as I wanted I also wanted to get rid of the [pid:MMDD/HHMMSS:severity:filename(line)] output prefix so I added the following:
console.log = function (d) {
process.stdout.write(d + '\n');
};
so that console logging was set back to stdout without extra details. Unfortunately also a work around.

How to get the result after each test case instead of logging the results into a file?

I'm using PHPUnit Selenium.
Is it possible to get the results of the test case in a json format or something and store it into a variable instead of logging it into a file? I don't want to read from a file.
For example, I run the test case testAsdf2. After the test case, i would like to get the results similar to the one below and store it into a variable and insert the results into a database
Is it possible to do that?
{"event":"test","suite":"JsonTest","test":"JsonTest::testAsdf2","status":"error","time":10.839267015457,"trace":[],"message":"\nInvalid response while accessing the Selenium Server at 'http:\/\/localhost:4444\/selenium-server\/driver\/': ERROR: Element id=asdfasfe not found","output":""}