What is page.reload([options]) in Playwright? - end-to-end

I couldn't find any detail explanation about the page.reload() method in Playwright. Is there anyone who can explain it to me in detail? Thanks!

Am I correct?
1. page.reload() --- just reload the webpage
2. page.reload(timeout=0) --- reload the webpage, disable timeout
3. page.reload(timeout=30000) --- reload the webpage, timeout = 30 seconds
4. page.reload(waitUntil='load') --- reload the webpage until consider operation to be finished
5. page.reload(timeout=0, waitUntil='load') --- .......

Related

Group Samplers between a GET and a DELETE Sampler

I'm using JMeter Proxy Server to record series of HTTP requests from a program and JMeter has already transform these HTTP requests to samplers for me. However, I want to group the samplers that are in-between a GET and a DELETE sampler.
To illustrate, the structure of my test plan generate by JMeter is similar to this. However, there are thounsands of requests and their method is not written on their name.
- Test plan
-- Recording Controller
--- GET Sampler1
--- POST Sampler2
--- DELETE Sampler3
--- GET Sampler4
--- POST Sampler5
--- DELETE Sampler6
Is there a way automatically or semi-automatically arrange the test plan into this structure:
- Test plan
--Recording Controller
--- Group1
---- GET Sampler1
---- POST Sampler2
---- DELETE Sampler3
--- Group2
---- GET Sampler4
---- POST Sampler5
---- DELETE Sampler6
where every sampler are group between a GET and a DELETE Sampler?
Press Ctrl + Left Mouse Click on Samplers you want to group
Right Mouse Click -> Insert Parent -> Logic Controller -> Choose Controller

Login fail attempt delay

I've read some about login security and I've found a good practice for preventing rapid-fire login attempts. The idea is apply a short time delay that increases with the number of failed attempts, like:
1 failed attempt = no delay
2 failed attempts = 2 sec delay
3 failed attempts = 4 sec delay
4 failed attempts = 8 sec delay
5 failed attempts = 16 sec delay
etc.
I understand the idea, but I would like to know how to code this.
Where and how should I put the delay? In the backend or in the frontend? I think it would be in the backend... But, how could I do that? How can I stop the current attempt for any seconds and continue? Any idea?
Thanks!
I find that I should put it in the backend using some method that delay the current thread like it's been seen here.
If I do that, it won't affect the other users, isn't it?

Rails 3.2.2 log files unordered, requests intertwined

I recollect getting log files that were nicely ordered, so that you could follow one request, then the next, and so on.
Now, the log files are, as my 4 year old says "all scroggled up", meaning that they are no longer separate, distinct chunks of text. Loggings from two requests get intertwined/mixed up.
For instance:
Started GET /foobar
...
Completed 200 OK in 2ms (Views: 0.4ms | ActiveRecord: 0.8ms)
Patient Load (wait, that's from another request that has nothing to do with foobar!)
[ blank space ]
Something else
This is maddening, because I can't tell what's happening within one single request.
This is running on Passenger.
I tried to search for the same answer but couldn't find any good info. I'm not sure if you should fix server or rails code.
If you want more info about the issue here is the commit that removed old way of logging https://github.com/rails/rails/commit/04ef93dae6d9cec616973c1110a33894ad4ba6ed
If you value production log readability over everything else you can use the
PassengerMaxInstancesPerApp 1
configuration. It might cause some scaling issues. Alternatively you could stuff something like this in application.rb:
process_log_filename = Rails.root + "log/#{Rails.env}-#{Process.pid}.log"
log_file = File.open(process_log_filename, 'a')
Rails.logger = ActiveSupport::BufferedLogger.new(log_file)
Yep!, they have made some changes in the ActiveSupport::BufferedLogger so it is not any more waiting until the request has ended to flush the logs:
http://news.ycombinator.com/item?id=4483390
https://github.com/rails/rails/commit/04ef93dae6d9cec616973c1110a33894ad4ba6ed
But they have added the ActiveSupport::TaggedLogging which is very funny and you can stamp every log with any kind of mark you want.
In your case could be good to stamp the logs with the request UUID like this:
# config/application.rb
config.log_tags = [:uuid]
Then even if the logs are messed up you still can follow which of them correspond to the request you are following up.
You can make more funny things with this feature to help you in your logs study:
How to log user_name in Rails?
http://zogovic.com/post/21138929607/running-time-in-rails-logs
Well, for me the TaggedLogging solution is a no go, I can live with some logs getting lost if the server crashes badly, but I want my logs to be perfectly ordered. So, following advice from the issue comments I'm applying this to my app:
# lib/sequential_logs.rb
module ActiveSupport
class BufferedLogger
def flush
#log_dest.flush
end
def respond_to?(method, include_private = false)
super
end
end
end
# config/initializers/sequential_logs.rb
require 'sequential_logs.rb'
Rails.logger.instance_variable_get(:#logger).instance_variable_get(:#log_dest).sync = false
As far as I can say this hasn't affected my app, it is still running and now my logs make sense again.
They should add some quasi-random reqid and write it in every line regarding one single request. This way you won't get confused.
I haven't used it, but I believe Lumberjack's unit_of_work method may be what you're looking for. You call:
Lumberjack.unit_of_work do
yield
end
And all logging done either in that block or in the yielded block are tagged with a unique ID.

Selenium test in Internet Explorer always times out?

I'm trying to run a basic test in Internet Explorer via Selenium-RC/PHPUnit, and it always returns with
# phpunit c:\googletest.php
PHPUnit 3.4.15 by Sebastian Bergmann.
E
Time: 35 seconds, Memory: 4.75Mb
There was 1 error:
1) Example::testMyTestCase
PHPUnit_Framework_Exception: Response from Selenium RC server for testComplete()
.
Timed out after 30000ms.
C:\googletest.php:17
FAILURES!
Tests: 1, Assertions: 0, Errors: 1.
Paul#PAUL-TS-LAPTOP C:\xampp
#
The last command in command history is waitForPageToLoad(30000). The same test runs fine and completes in firefox. How can I get this test to run and complete in internet explorer?
Thanks
There's an open bug in selenium that causes waitForPageToLoad to sometimes timeout on IE.
http://jira.openqa.org/browse/SRC-552
It's marked as occurring on IE6, but I'm experiencing the same error in at least IE9.
A workaround is to wait for e.g. a specific DOM-element on the page that is loading instead of using waitForPageToLoad. For example: waitForVisible('css=#header')
Try going into Internet Options and turn off Protected mode under the security tab. You may also want to decrease the security level for the Internet zone.
I've turned off protected mode and looks like it helped.
If it is acceptable to customize the client driver, here is the Python implementation for your refernece:
def open(self):
timeout = self.get_eval('this.defaultTimeout')
self.set_timeout(0)
self.do_command("open", [url,ignoreResponseCode])
self.set_timeout(timeout)
self.wait_for_page_to_load(timeout)
def wait_for_page_to_load(self,timeout):
# self.do_command("waitForPageToLoad", [timeout,])
import time
end = time.time() + int(float(timeout) / 1000)
while time.time() < end:
if self.get_eval('window.document.readyState') == 'complete': return
time.sleep(2)
raise Exception('Time out after %sms' % timeout)
I just use DOM attribute document.readyState to determine if the page is fully loaded.
IE 9+ intermittently throws a timeout error even the page is fully loaded, for more details.

SQL Server trace - translating PAGE information to actual resource

I am researching deadlocks that are happening in our application. I turned trace on for 1204, 1205 and 3605. I got the deadlock trace alright. But I am unable to figure out the resource it is deadlocking on. I have read many forums and they all say that the trace should contain something called a KEY/RID which would point to the resource in question. But my trace files does not contain KEY/RID at all. Instead it contains something called as PAGE.
For example,
06/30/2010 16:29:52,spid4s,Unknown,PAGE: 8:1:16512 CleanCnt:2 Mode:IX Flags: 0x2
06/30/2010 16:29:52,spid4s,Unknown,PAGE: 8:1:5293 CleanCnt:2 Mode:IX Flags: 0x2
How can I determine what this resource is, based on this PAGE information I am getting? Thanks in advance for your help!
it looks like the lock is being done at a page level. Check out http://msdn.microsoft.com/en-us/library/aa937573(SQL.80).aspx > Using Trace Flag 1204 > Terms in a Trace Flag 1204 Report > PAG
PAG
Identifies the page resource on which
a lock is held or requested.
PAG is represented in Trace Flag 1204
as PAG: db_id:file_id:page_no; for
example, PAG: 7:1:168.
Edit
Use DBCC PAGE (http://support.microsoft.com/kb/83065 or http://www.sqlmonster.com/Uwe/Forum.aspx/sql-server/26555/Determining-table-for-a-particular-File-id-Page-No) to get the object id from the page information,
then use OBJECT_NAME (http://msdn.microsoft.com/en-us/library/ms186301.aspx) or query sys.objects to get the resource