YOU NEED TO KNOW
About selenium
What is Selenium 3.0
Selenium web application testing programming has been
utilized for various years, and the advantages tore by developers make it
important to keep enhancing the system. There are diverse variants of selenium
that have been created. We think about Selenium remote control, Selenium 2.0
and the most recent adaptation which is Selenium
3.0. Every one of these renditions is a change of the last form and in this
manner better client encounter.
Create An Application User
An Application User is the Selenium
portrayal of the backend of the site. For us, this implied making another
Lucidchart or Lucidpress client, setting up a membership, and perhaps making an
archive. This class contained the assistant techniques to set up a test
situation and all the teardown toward the finish of a test. This class
additionally contained access to our backend administrations to make things,
for example, including colleagues, transferring pictures or textual styles, and
changing membership levels extremely simple. The accompanying is a case of how
a designer would utilize the application client.
class EditorPerformanceTest broadens LucidSpec {
val client = new ChartUser
abrogate def beforeAll() {
user.login()
user.createDocument()
}
abrogate def afterAll() {
user.finished()
}
In this circumstance, all setup was improved to two simple
technique calls, leaving the test prepared to go in the proofreader. Toward the
finish of the test, the majority of the tear down (shutting the driver,
database expulsion, and so forth) is dealt with in the completed technique. By
abstracting the majority of this, (and in addition a few other aide strategies)
into a User class, we made it considerably less demanding for designers to get
a test set up and prepared to approve a bug or highlight.
Use DOM IDs
Finding a component in the DOM can be a standout amongst the
most difficult parts of a Selenium
test. IDs give an approach to key components to be particularly recognized
inside the whole item. In a portion of our unique tests, we utilized XPaths,
class ways, and other complex CSS selectors to find vital components. In any
case, when a component moved to a better place in the UI, or essentially simply
changed its CSS class names (due to overhaul or refactoring), refreshing the
test required backpedaling and finding that component once more. With IDs, a
component is identifiable paying little heed to where it is in the DOM and what
styling is connected to it.
The following is a case of a noteworthy port we did in the
Publish discourse of Lucidpress. This specific element had 4 Selenium
test suites, or around 30 tests altogether. There were moreover another
20-30 tests that utilized the exchange somehow. Since we utilized IDs, the vast
majority of the tests required next to zero refreshing. The test could discover
the distribute catch, produce code catch, measure selectors, and other key
components with no issues. This turned what could have been for all intents and
purposes revising every one of the tests, into essentially rolling out a few
improvements in how to explore to the right tab of the exchange.
Retry Actions
The most compelling motivation for false negatives in our Selenium
test suite was Selenium stretching out beyond the program. Selenium would
snap to open a board and after that before the javascript could execute to open
the board, Selenium was at that point endeavoring to utilize it. This prompted
a great deal of special cases for stale component, component not found, and
component not interactive.
On the principal pass, the arrangement was straightforward:
each time we got one of these blunders, basically include a little pause. In
the event that regardless it fizzled, make the hold up longer. While this
arrangement worked much of the time, it was not rich and prompted a great deal
of time leaving the program simply sitting and pausing. Selenium
tests are as of now sufficiently moderate without the unequivocal pauses.
With an end goal to take care of this issue, we took a
gander at a portion of the alternatives that Selenium makes accessible
(FluentWait, Explicit Waits, and Implicit Waits) yet we were not able make them
work in every one of the circumstances that we required for our application.
From these illustrations, we chose to set up our own surveying framework that
would fit our needs.
/**
* Try and make a move until the point that it restores an
esteem or we timeout
* @param maxWaitMillis the greatest measure of time to
continue striving for in milliseconds
* @param pollIntervalMillis the measure of time to hold up
between retries in milliseconds
* @param callback a capacity that gets an esteem
* @tparam A the kind of the callback
* @return whatever the callback returns, or tosses an
exemption
*/
@annotation.tailrec
private def retry[A](maxWaitMillis: Long,
pollIntervalMillis: Long)(callback: => An): A = {
val begin = System.currentTimeMillis
Attempt {
callback
} coordinate {
case Success(value) => esteem
case Failure(thrown) => {
val timeForTest = System.currentTimeMillis - begin
val maxTimeToSleep = Math.min(maxWaitMillis -
pollIntervalMillis, pollIntervalMillis)
val timeLeftToSleep = maxTimeToSleep - timeForTest in the
event that (maxTimeToSleep <= 0) { toss tossed } else { if (timeLeftToSleep
> 0) {
Thread.sleep(timeLeftToSleep)
}
retry(maxWaitMillis - pollIntervalMillis,
pollIntervalMillis)(callback)
}
}
}
}
The premise of our retry code is a straightforward recursive
calculation that takes a capacity, max hold up time, and surveying time. It
executes the capacity until the point when it succeeds, or until the point when
the maximum hold up time is surpassed. From this technique, we actualized three
adaptations for our three one of a kind cases.
1.Get with
retry takes a capacity with an arrival esteem
def numberOfChildren(implicit client: LucidUser): Int = {
getWithRetry() {
user.driver.getCssElement(visibleCss).children.size
}
}
2.Do with retry
takes a capacity with no arrival write
def clickFillColorWell(implicit client: LucidUser) {
doWithRetry() {
user.clickElementByCss("#fill-colorwell-shading great
wrapper")
}
3.Predicate
with retry takes work that profits a boolean and will retry on any false
qualities
def onPage(implicit client: LucidUser): Boolean = {
predicateWithRetry() {
user.driver.getCurrentUrl.contains(pageUrl)
}
}
With these three techniques, we could diminish our false
negatives down to around 2%. The greater part of our techniques default to a
maximum hold up time of 1 second and a surveying interim of 50 milliseconds so
the postponement is immaterial. In our best illustration, we could turn a test
that was a false negative around 10% of the time and took 45 seconds into a
test that delivered no false negatives and just took 33 seconds to run.
Note:
Want to know more about Selenium. Reach Besant Technologies:



ACTE is a national association representing thousands of career and technical education professionals, all working to make a real difference in students' lives.
ReplyDeletedata science training in chennai
data science training in omr
android training in chennai
android training in omr
devops training in chennai
devops training in omr
artificial intelligence training in chennai
artificial intelligence training in omr
Awesome blog, very informative content... Thanks for sharing waiting for next update...
ReplyDeleteangular js training in chennai
angular js training in annanagar
full stack training in chennai
full stack training in annanagar
php training in chennai
php training in annanagar
photoshop training in chennai
photoshop training in annanagar
Thank you for sharing this blog post. Hope the below links are useful for software qa testing job seekers,
ReplyDeleteQA Testing Job Board
Software Testing Jobs
Software Testing Internships
Remote QA Jobs