where we are using delegates in selenium automation testing

+1 vote
Hi ,

where we are using delegates in selenium automation testing
Aug 25, 2020 in Selenium by Sri
• 3,190 points
417 views

1 answer to this question.

0 votes

Hello @Sri ,

Delegates are similar to pointers available in C++. It is basically a reference type variable that contains a reference to another method.

Further, its reference cannot be changed during the run time. It is available inside System.Delegate class. A delegate is used to handle call back function or an event handler.

It is like a pointer to a function and can be declared using the keyword delegate followed by the signature of the function.

For more detail you can refer this:https://www.softwaretestinghelp.com/csharp-delegate/#:~:text=A%20delegate%20is%20a%20pointer,can%20also%20be%20invoked%20similarly.

Hope it helps you!!

Thank you!!

answered Aug 26, 2020 by Niroj
• 82,820 points
hi @ Niroj,

Where exactly we are using this in automation testing . could u plz give a me some really time example.
In a real-time scenario, It is used for Callbacks.

Consider you have a long-running method and you need to check that run progress continuously. To do that we use callback using a delegate. This allows us to keep track of the long-running method.
Thanks Niroj,

But continuous monitoring we may use assertions or logs right ..?

So if u dont mind Could explain clearly.

Thanks,

Srikar.

If you want to call all methods through one navigator object instead of a lot of page objects directly.

Navigator pattern exists to do some additional things before or after or even instead of passed him methods to Page Objects.

So, you could implement Navigator pattern in C# and it uses delegates

Related Questions In Selenium

0 votes
1 answer
0 votes
2 answers

How can we take screenshots of tests in Selenium 2 using C#

Hey, try using following code command to ...READ MORE

answered Aug 22, 2019 in Selenium by Abha
• 28,040 points
450 views
+2 votes
3 answers

How can we handle authentication popup in Selenium WebDriver using Java

1) By passing user credentials in URL. String ...READ MORE

answered Aug 30, 2020 in Selenium by Sri
• 3,190 points
23,055 views
0 votes
1 answer

Is it possible for a website to detect that we are using Selenium with ChromeDriver

Selenium tests for pre-defined javascript variables which ...READ MORE

answered Apr 27, 2018 in Selenium by Meci Matt
• 9,460 points
4,959 views
0 votes
2 answers

What are the things we cannot automate using selenium?

1) Regression TC that require manual involvement ...READ MORE

answered Feb 26, 2020 in Selenium by Divya Krishnan
7,080 views
0 votes
1 answer
+2 votes
1 answer

How to fetch the text of a web element where the text is split in 2 lines?

Hello, You want to use a non-breaking space ...READ MORE

answered May 28, 2020 in Selenium by Niroj
• 82,820 points
1,425 views
0 votes
1 answer

How to Handle alerts like Irctc alert in selenium?

Hello  karthik, Handling alerts manually is a tedious task. ...READ MORE

answered Jun 29, 2020 in Selenium by Niroj
• 82,820 points
676 views