How to save the the exact class and method name on screenshot in selenium?

13 views
Skip to first unread message

javel...@gmail.com

unread,
May 13, 2018, 3:00:24 PM5/13/18
to Selenium Users
Dear Selenium and Java user, 

I am interested to save the class and method name in which I have written the code(screenshot code), Is there any way to save the class and method name in such way that even through in future; class and method name is changed, i will pick the new name automatically? 

I know we can write manually String methodName = "mentionTheMethodNameHere"  but we have to change it each time manually, is there any way to make it automatic i.e whenever the user change the method name it can pick the latest method name?? 
Thanks, 
Java lover.. 

javel...@gmail.com

unread,
May 13, 2018, 4:52:24 PM5/13/18
to Selenium Users
Hello users, I have found the way withIn the Main method HalfEbayTest obj = new HalfEbayTest(); String a = obj.getClass().getTypeName();  System.out.println(a);   

It give us the class name, is there anyway to do this without the main method or without creating the object.. ??

Thanks, 
Java Lover 

Reed Xia

unread,
May 14, 2018, 10:33:31 PM5/14/18
to seleniu...@googlegroups.com
For your reference, I have done some code for adding screenshot in selenium to Jenkins as JUnit attachment, see https://gist.github.com/python012/d962d797fa57a3e893d5be14b87de1b9.

Hop it helps.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/7462f3d8-b515-4395-a2fd-dd5f8b3d2ccf%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages