where we are using delegates in selenium automation testing

+1 vote
Hi ,

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

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!!

Check out automation engineer course and learn more.

Thank you!!

answered Aug 26, 2020 by Niroj
• 82,880 points

edited Jul 19, 2023 by Khan Sarfaraz
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.



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

What are the benefits and drawbacks of using Test Driven Development in Automation testing?

Hi Sharon, Test Driven Development (TDD) is an iterative ...READ MORE

answered Aug 5, 2019 in Selenium by Anvi
• 14,150 points
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 23, 2019 in Selenium by Abha
• 28,140 points
+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 31, 2020 in Selenium by Sri
• 3,190 points
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 28, 2018 in Selenium by Meci Matt
• 9,460 points
0 votes
2 answers

What are the things we cannot automate using selenium?

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

answered Feb 27, 2020 in Selenium by Divya Krishnan
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,880 points
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,880 points
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP