public string ClickBtnFromKeyboard(string btn, int timer = 5000)
{
return Click(btn, "", timer);
}
/// <summary>
/// Непосредственное нажатие на кнопку
/// </summary>
/// <param name="btn"></param>
/// <param name="FromClick"></param>
/// <param name="timer"></param>
/// <returns></returns>
public string Click(string btn, string FromClick = "", int timer = 5000)
{
string ClickMsg = "(//div[@class='im_history_messages_peer']/descendant::div[@class='im_message_keyboard']/descendant::button[@class='btn reply_markup_button' and contains(string(), '{0}')])[last()]|(//div[@class='im_history_messages_peer']/descendant::div[@class='im_message_keyboard']/descendant::a[@class='btn reply_markup_button' and contains(string(), '{0}')])[last()]".f(btn);
string ClickSend = "//div[@class='im_send_keyboard_wrap']/descendant::button[@class='btn reply_markup_button' and contains(string(), '{0}')]".f(btn);
string xpath = FromClick == "msg" ? ClickMsg : ClickSend;
var button = tab.FindEl(xpath);
if (button.IsVoid)
{
project.Info("Аккаунт: {0} Бот: {1} -> Нет кнопки: '{2}'".f(Account, BotAddress, btn));
return "return";
}
else
{
button.Click();
project.Info("Аккаунт: {0} Бот: {1} -> Нажали: '{2}'".f(Account, BotAddress, btn));
}
return "continue";
}