Клик по ссылке

GerardFrank

Client
Регистрация
26.12.2019
Сообщения
12
Благодарностей
0
Баллы
1
Подскажите пожалуйста как можно организовать клик по ссылке, полученной с помощью регулярок? Ссылка имеет вид <a _ngcontent-nqw-c5="" target="_blank"><span _ngcontent-nqw-c5="" class="icon-menu-adc_download pointer" life="2000" tooltipposition="left"></span></a> и находится в переменной, ну или в строку можно переложить)
 

Burklive

Client
Регистрация
10.05.2017
Сообщения
123
Благодарностей
31
Баллы
28
в чём проблема получить ссылку кнопки или что там вообще?
 

GerardFrank

Client
Регистрация
26.12.2019
Сообщения
12
Благодарностей
0
Баллы
1
в чём проблема получить ссылку кнопки или что там вообще?
По клику на тег <a> появляется всплывающее окно, в котором и находится кнопка для скачивания, с ссылкой в атрибуте. В Dom и сорс ссылки данной нет
 

Burklive

Client
Регистрация
10.05.2017
Сообщения
123
Благодарностей
31
Баллы
28
можно ссылку на сайт посмотреть что за кнопка такая волшебная.
вам нужно через браузер или GET/POST?
 

GerardFrank

Client
Регистрация
26.12.2019
Сообщения
12
Благодарностей
0
Баллы
1
можно ссылку на сайт посмотреть что за кнопка такая волшебная.
вам нужно через браузер или GET/POST?
Ссылку дать к сожалению не могу, так как это в личном кабинете находится, но могу обрисовать картину наиболее подробно. Я пытаюсь делать через браузер.

1. Есть такой список файлов http://joxi.ru/12M898aU07Wddm в таком виде в Dom и сорс ссылок на скачивание нет.
2. Но если нажать на "<a>.....</a> то появляется такое окно http://joxi.ru/bmoG1GPh9j11Nm и уже нажимая на кнопку "Download" идёт загрузка файла.
3 Я пытаюсь настроить автоматическое скачивание файла, зная только его ID (пятизначный номер)
4. Когда это окошке появляется в DOM оно выглядит так: "
</p-dialog><p-dialog _ngcontent-txm-c5="" header="Download prelanding" class="ng-tns-c9-2"><!----><div role="dialog" class="ng-trigger ng-trigger-animation ng-tns-c9-2 ui-dialog ui-widget ui-widget-content ui-corner-all ui-shadow ui-dialog-resizable ng-star-inserted" aria-labelledby="ui-dialog-1-label" style="width: 500px; z-index: 1024; left: 71px; top: 323px; transform: none; opacity: 1;"><!----><div class="ui-dialog-titlebar ui-widget-header ui-helper-clearfix ui-corner-top ng-tns-c9-2 ng-star-inserted" style=""><!----><span class="ui-dialog-title ng-tns-c9-2 ng-star-inserted" id="ui-dialog-1-label">Download prelanding</span><!----><!----><a role="button" tabindex="0" class="ng-tns-c9-2 ui-dialog-titlebar-icon ui-dialog-titlebar-close ui-corner-all ng-star-inserted"><span class="pi pi-times"></span></a><!----></div><div class="ui-dialog-content ui-widget-content" style=""><div _ngcontent-txm-c5="" class="row"><div _ngcontent-txm-c5="" class="col-12 col-md-12"><div _ngcontent-txm-c5="" class="input_label">Redirect URL</div><div _ngcontent-txm-c5="" class="adc_input_wr bgf0 pb20"><input _ngcontent-txm-c5="" type="text" class="ng-untouched ng-pristine ng-valid"></div></div></div></div><!----><div class="ui-dialog-footer ui-widget-content ng-tns-c9-2 ng-star-inserted" style=""><p-footer _ngcontent-txm-c5=""><div _ngcontent-txm-c5="" class="flex_buttons"><button _ngcontent-txm-c5="" class="newbtn"> Download </button></div></p-footer></div><!----><div class="ui-resizable-handle ui-resizable-se ui-icon ui-icon-gripsmall-diagonal-se ng-tns-c9-2 ng-star-inserted" style="z-index: 90;"></div></div></p-dialog></div></div></div></div>
<!-- end::Body -->

<div class="ui-widget-overlay ui-dialog-mask ui-dialog-mask-scrollblocker" style="z-index: 1023;"></div></body></html>"
 

Astraport

Client
Регистрация
01.05.2015
Сообщения
4 943
Благодарностей
4 340
Баллы
113
Что-то типа:
C#:
HtmlElement he = instance.ActiveTab.FindElementByAttribute("button", "class", "newbtn", "text", 0);
if (he.IsVoid) return null;
he.Click();
Но сначала нужно нажать на ссылку <a
 
  • Спасибо
Реакции: GerardFrank

GerardFrank

Client
Регистрация
26.12.2019
Сообщения
12
Благодарностей
0
Баллы
1
Что-то типа:
C#:
HtmlElement he = instance.ActiveTab.FindElementByAttribute("button", "class", "newbtn", "text", 0);
if (he.IsVoid) return null;
he.Click();
Но сначала нужно нажать на ссылку <a
Спасибо за код) Остаётся только понять как нажать на ссыль <a> Зная только пятизначное Id строки) Это пока самый главней вопрос)
 

Astraport

Client
Регистрация
01.05.2015
Сообщения
4 943
Благодарностей
4 340
Баллы
113
Спасибо за код) Остаётся только понять как нажать на ссыль <a> Зная только пятизначное Id строки) Это пока самый главней вопрос)
Покажите кусок кода, где у вас ссыль <a> и это уникальное id. В примере выше не нахожу.
 
  • Спасибо
Реакции: GerardFrank

GerardFrank

Client
Регистрация
26.12.2019
Сообщения
12
Благодарностей
0
Баллы
1
Покажите кусок кода, где у вас ссыль <a> и это уникальное id. В примере выше не нахожу.
[46384] Money Amulet - zodiac - IT</span><!----></div><div _ngcontent-gwq-c5="" class="flex-column"><a _ngcontent-gwq-c5="" target="_blank"><span _ngcontent-gwq-c5="" class="icon-menu-adc_download pointer" life="2000" tooltipposition="left"></span></a><a _ngcontent-gwq-c5="" target="_blank" href="//land1.abxyz.info/preview/?preland_name=kUiEZE0xaULmVhR&amp;offer_id=15968"><span _ngcontent-gwq-c5="" class="icon-menu-adc_open-link pointer" life="2000" tooltipposition="left"></span></a></div></div><div _ngcontent-gwq-c5="" class="adc_land-item true active ng-star-inserted"><div _ngcontent-gwq-c5="" class="flex-column adc_input_wr adc_checkbox_radio no_label"><p-radiobutton _ngcontent-gwq-c5="" name="current_preland" class="ng-untouched ng-pristine ng-valid"><div class="ui-radiobutton ui-widget"><div class="ui-helper-hidden-accessible"><input type="radio" name="current_preland" value="45392"></div><div class="ui-radiobutton-box ui-widget ui-state-default ui-state-active"><span class="ui-radiobutton-icon ui-clickable pi pi-circle-on"></span></div></div><!----></p-radiobutton></div><div _ngcontent-gwq-c5="" class="flex-column"><!----><span _ngcontent-gwq-c5="" class="pointer ng-star-inserted">[45392] Money Amulet - IT - woman (cens)</span><!----></div><div _ngcontent-gwq-c5="" class="flex-column"><a _ngcontent-gwq-c5="" target="_blank"><span _ngcontent-gwq-c5="" class="icon-menu-adc_download pointer" life="2000" tooltipposition="left"></span></a><a _ngcontent-gwq-c5="" target="_blank" href="//land1.abxyz.info/preview/?preland_name=VlKIuAYGV0ZxCg2&amp;offer_id=15968"><span _ngcontent-gwq-c5="" class="icon-menu-adc_open-link pointer" life="2000" tooltipposition="left"></span></a></div></div><div _ngcontent-gwq-c5="" class="adc_land-item true ng-star-inserted"><div _ngcontent-gwq-c5="" class="flex-column adc_input_wr adc_checkbox_radio no_label"><p-radiobutton _ngcontent-gwq-c5="" name="current_preland" class="ng-untouched ng-pristine ng-valid"><div class="ui-radiobutton ui-widget"><div class="ui-helper-hidden-accessible"><input type="radio" name="current_preland" value="45271"></div><div class="ui-radiobutton-box ui-widget ui-state-default"><span class="ui-radiobutton-icon ui-clickable"></span></div></div><!----></p-radiobutton></div><div _ngcontent-gwq-c5="" class="flex-column"><!----><span _ngcontent-gwq-c5="" class="pointer ng-star-inserted">[45271]
 

GerardFrank

Client
Регистрация
26.12.2019
Сообщения
12
Благодарностей
0
Баллы
1

Astraport

Client
Регистрация
01.05.2015
Сообщения
4 943
Благодарностей
4 340
Баллы
113
Очень тяжело писать код без страницы, но попробую))
C#:
string id = project.Variables["your_id"].Value;
HtmlElementCollection hes = instance.ActiveTab.FindElementsByAttribute("div", "class", "flex-column", "text");
HtmlElement he = null;
int index = -1;
for (int i = 0; i < hes.Count; i++) {
    he = hes.GetByNumber(i);
    if (he.GetAttribute("innerhtml").Contains("[" + id + "]")) {
        index = i + 1;
        break;
    }
}
if (index > -1) {
    he = instance.ActiveTab.FindElementByAttribute("div", "class", "flex-column", "text", index).FirstChild;
    he.Click();
} else {
    project.SendInfoToLog("Not found item with id " + id);
}
 
  • Спасибо
Реакции: Roman48 и GerardFrank

GerardFrank

Client
Регистрация
26.12.2019
Сообщения
12
Благодарностей
0
Баллы
1
Очень тяжело писать код без страницы, но попробую))
C#:
string id = project.Variables["your_id"].Value;
HtmlElementCollection hes = instance.ActiveTab.FindElementsByAttribute("div", "class", "flex-column", "text");
HtmlElement he = null;
int index = -1;
for (int i = 0; i < hes.Count; i++) {
    he = hes.GetByNumber(i);
    if (he.GetAttribute("innerhtml").Contains("[" + id + "]")) {
        index = i + 1;
        break;
    }
}
if (index > -1) {
    he = instance.ActiveTab.FindElementByAttribute("div", "class", "flex-column", "text", index).FirstChild;
    he.Click();
} else {
    project.SendInfoToLog("Not found item with id " + id);
}
Все заработало, спасибо огромное!
 

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