Is there possible to override click() method?

289 views
Skip to first unread message

macie...@gmail.com

unread,
Jan 11, 2017, 4:23:34 AM1/11/17
to selenide
Hi,
I have to check if some element exist on a page before every click().
Is there possible to modify/override Selenide click() method to force it to call a method which check if element exists and then make a click?

Regards,
Maciek

Andrei Solntsev

unread,
Jan 11, 2017, 6:24:34 AM1/11/17
to macie...@gmail.com, selenide
Hi Maciek!
Yes, you can override method click, but in your case it's not needed, because method click() does check for element  existence and visibility.

--
You received this message because you are subscribed to the Google Groups "selenide" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenide+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

macie...@gmail.com

unread,
Jan 11, 2017, 6:46:39 AM1/11/17
to selenide, macie...@gmail.com
Hi,
Thanks for your answer.
Unfortunately it's not so simple ;)
I have a progress bar in my app. When progress bar is displayed Selenide can click on any element on a page but there is no effect of this click.
So before I can perform click on any element I have to chack if progress bar is not exist. I can do it before every click() but imho a better solution is override click method.
How can I do it?

Regards,
Maciek

W dniu środa, 11 stycznia 2017 12:24:34 UTC+1 użytkownik Andrei Solntsev napisał:
> Hi Maciek!
> Yes, you can override method click, but in your case it's not needed, because method click() does check for element  existence and visibility.
>
>
> On Jan 11, 2017 11:23 AM, <macie...@gmail.com> wrote:
> Hi,
>
> I have to check if some element exist on a page before every click().
>
> Is there possible to modify/override Selenide click() method to force it to call a method which check if element exists and then make a click?
>
>
>
> Regards,
>
> Maciek
>
>
>
> --
>
> You received this message because you are subscribed to the Google Groups "selenide" group.
>
> To unsubscribe from this group and stop receiving emails from it, send an email to selenide+u...@googlegroups.com.

Andrei Solntsev

unread,
Feb 24, 2017, 6:07:35 PM2/24/17
to Mac H, selenide
Hi Maciek!
You can override any of Selenide method by doing so:


Commands.getInstance().add("click", new MyClick());

public class MyClick extends com.codeborne.selenide.commands.Click {...}

Andrei Solntsev

To unsubscribe from this group and stop receiving emails from it, send an email to selenide+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages