Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- HtmlElement company_name = null;
- HtmlElement adress = null;
- HtmlElementCollection phones = null;
- HtmlElement website = null;
- HtmlElement email = null;
- HtmlElement mid_rating = null;
- string str_phones = string.Empty;
- company_name = instance.ActiveTab.FindElementByXPath("//h1[@class = '_1r7sat2']/span[@class = '_oqoid']", 0);
- adress = instance.ActiveTab.FindElementByXPath("//span[@class = '_14quei']/descendant::a[@class = '_84s065h']", 0);
- website = instance.ActiveTab.FindElementByXPath("//div[@class='_49kxlr']/span/div/a[@class = '_13ptbeu']", 0);
- email = instance.ActiveTab.FindElementByXPath("//div[@class = '_49kxlr']/descendant::a[contains(text(), '@')]", 0);
- mid_rating = instance.ActiveTab.FindElementByXPath("//span[@class = '_1n8h0vx']", 0);
- phones = instance.ActiveTab.FindElementsByXPath("//div[@class = '_b0ke8']");
- if (phones.Count<=1) {
- str_phones = phones.GetByNumber(0).InnerText;
- }
- else {
- foreach (var phone in phones) {
- str_phones = str_phones + phone.InnerText + "; " + Environment.NewLine;
- }
- }
- project.Variables["cur_company_name"].Value = company_name.InnerText;
- project.Variables["cur_company_adress"].Value = adress.InnerText;
- project.Variables["cur_company_website"].Value = website.InnerText;
- project.Variables["cur_company_email"].Value = email.InnerText;
- project.Variables["cur_company_mid_rating"].Value = mid_rating.InnerText;
- project.Variables["cur_company_phones"].Value = str_phones;
- 2-й Кубик 2-й Кубик 2-й Кубик 2-й Кубик 2-й Кубик 2-й Кубик 2-й Кубик 2-й Кубик 2-й Кубик 2-й Кубик 2-й Кубик 2-й Кубик 2-й Кубик
- string str_for_excel = string.Empty;
- string query_fields = project.Variables["query_fields"].Value;
- string name = "Название";
- string adress = "адрес";
- string phones = "телефоны";
- string website = "сайт";
- string email = "email";
- string social = "социальные сети";
- string mid_rating = "средняя оценка";
- string advertisement_link = "ссылка объявления";
- string str_all_socials = string.Empty;
- //Проверяем какие поля ввел пользователь во входящих настройках
- if(query_fields.Contains(name)) {
- str_for_excel = "{-Variable.cur_company_name-}";
- }
- if(query_fields.Contains(adress)) {
- str_for_excel = str_for_excel + "{-String.Tab-}{-Variable.cur_company_adress-}";
- }
- if(query_fields.Contains(phones)) {
- str_for_excel = str_for_excel + "{-String.Tab-}{-Variable.cur_company_phones-}";
- }
- if(query_fields.Contains(website)) {
- str_for_excel = str_for_excel + "{-String.Tab-}{-Variable.cur_company_website-}";
- }
- if(query_fields.Contains(email)) {
- str_for_excel = str_for_excel + "{-String.Tab-}{-Variable.cur_company_email-}";
- }
- if(query_fields.Contains(social)) {
- //проверяем есть ли вк
- if(project.Variables["cur_company_vk"].Value!="") {
- str_all_socials = project.Variables["cur_company_vk"].Value;
- }
- //проверяем есть ли фб
- if(project.Variables["cur_company_facebook"].Value!="") {
- str_all_socials = str_all_socials + "; " + project.Variables["cur_company_facebook"].Value;
- }
- //проверяем есть ли инстаграм
- if(project.Variables["cur_company_instagramm"].Value!=""){
- str_all_socials = str_all_socials + "; " + project.Variables["cur_company_instagramm"].Value;
- }
- //формируем строку с соц. сетями, // добавить перенос строки
- str_for_excel = str_for_excel + str_all_socials;
- }
- if(query_fields.Contains(mid_rating)) {
- str_for_excel = str_for_excel + "{-String.Tab-}{-Variable.cur_company_mid_rating-}";
- }
- if(query_fields.Contains(advertisement_link)) {
- str_for_excel = str_for_excel + "{-String.Tab-}{-Variable.cur_link-}";
- }
- project.Variables["str_for_excel"].Value = str_for_excel;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement