Text Area - How to click at the end of a specific sentence ?

Adé

Пользователь
Регистрация
05.03.2015
Сообщения
31
Благодарностей
1
Баллы
8
Hi all,

I'm working on a template using a online text area. I'm facing some issue on one action.

I need to click at the end of a sentence on each article i'm working on.

In the example below, I need to click and get the cursor where the red cross is.

92590


It's always the same thing on every article. I need to click just after closing balise paragraph </p> and before balise title opening <h2> .

I'm running out of ideas to get this action completed correctly.

Do you guys have any idea ?

Thx for your help.
 

BAZAg

Client
Регистрация
08.11.2015
Сообщения
1 764
Благодарностей
2 407
Баллы
113
C#:
instance.ActiveTab.Navigate("https://zennolab.com/discussion/threads/text-area-how-to-click-at-the-end-of-a-specific-sentence.103416/");
HtmlElement he = instance.ActiveTab.FindElementByAttribute("article", "class", "message-body", "text", 0);
if (he.IsVoid) return -1;

int x = int.Parse(he.GetAttribute("leftinbrowser")) +int.Parse(he.GetAttribute("clientwidth")) ;
int y =  int.Parse(he.GetAttribute("topinbrowser")) +int.Parse(he.GetAttribute("clientheight")) ;

instance.ActiveTab.FullEmulationMouseMove(x,y);
instance.ActiveTab.FullEmulationMouseClick("left","click");
 
  • Спасибо
Реакции: morpheus93

Adé

Пользователь
Регистрация
05.03.2015
Сообщения
31
Благодарностей
1
Баллы
8
HI BAZAg, and thank you for your answer.

I'm trying to understand your C# code, but I can't :(

I tried it, but It doens not click where I want.

Can you please explain me your code, if you have time ?
 

BAZAg

Client
Регистрация
08.11.2015
Сообщения
1 764
Благодарностей
2 407
Баллы
113
HI BAZAg, and thank you for your answer.
I'm trying to understand your C# code, but I can't :(
I tried it, but It doens not click where I want.
Can you please explain me your code, if you have time ?
I am writing with Google translator - the context of the message may differ from what I want to say.

1. Go to the page in the active tab.
2. We are looking for the desired element (You will look for your element there).
3. If the element is not found, exit the code without an error
4. Determine how many pixels we will move the mouse to the left (by the width of the element)
5. Determine how many pixels we will move the mouse down (to the height of the element)
6. Move the mouse to the coordinate that was calculated in step 4-5.
7. We make a click in this coordinate.

To solve your problem - you must independently determine the element that I have in step 2.
After that - the code will find the lower right coordinate of this element, move the mouse there and click.
 
  • Спасибо
Реакции: Adé

Adé

Пользователь
Регистрация
05.03.2015
Сообщения
31
Благодарностей
1
Баллы
8
Thank you very much for your explanation ! I start to understand.

I'm trying to implement this in my template, and I suppose I need to change the variable in line 2:

HtmlElement he = instance.ActiveTab.FindElementByAttribute("article", "class", "message-body", "text", 0);

by something like that:

HtmlElement he = instance.ActiveTab.FindElementByAttribute("project.Variables["Paragraph"].Value", 0);

(Not sure at all about what i've done hereabove)

Where element properties are :

92616


and variable "Paragraph" is :

Zennoposter is the best tool for SEO that I have come across. It does an excellent job of tracking your keyword rankings.

What do you think BAZAg ?

Thanks anyway :-)
 

BAZAg

Client
Регистрация
08.11.2015
Сообщения
1 764
Благодарностей
2 407
Баллы
113
Thank you very much for your explanation ! I start to understand.

I'm trying to implement this in my template, and I suppose I need to change the variable in line 2:

HtmlElement he = instance.ActiveTab.FindElementByAttribute("article", "class", "message-body", "text", 0);

by something like that:

HtmlElement he = instance.ActiveTab.FindElementByAttribute("project.Variables["Paragraph"].Value", 0);

(Not sure at all about what i've done hereabove)

Where element properties are :

Посмотреть вложение 92616

and variable "Paragraph" is :

Zennoposter is the best tool for SEO that I have come across. It does an excellent job of tracking your keyword rankings.

What do you think BAZAg ?

Thanks anyway :-)
This is how you should be looking.
But, I'm not sure, through the action constructor you need to look for the desired element, look at the parameters there and substitute them already.
C#:
HtmlElement he = instance.ActiveTab.FindElementByAttribute("wysiwyg:p", "value", project.Variables["Paragraph"].Value, "text", 0);
 
  • Спасибо
Реакции: Adé

Кто просматривает тему: (Всего: 1, Пользователи: 0, Гости: 1)