C# blocks are not executed in the launcher

  • Автор темы Автор темы Valbers
  • Дата начала Дата начала

Valbers

Client
Регистрация
27.12.2021
Сообщения
8
Реакции
1
Баллы
3
Hi, when I launch a project with c# blocks outside the project maker the c# code is not executed, I tried with very basic instructions like "sendInfoToLog", but nothing... has anyone encountered the problem?
 
Hi, when I launch a project with c# blocks outside the project maker the c# code is not executed, I tried with very basic instructions like "sendInfoToLog", but nothing... has anyone encountered the problem?
outside the project maker the c# code is not executed... where is this for example ?
 
what errors do you get in execution log?
 
In zenoposter, where you can set the number of threads
is the output parameter in the log worth it ?

99052
 
I didn't pay attention to this parameter!

The problem comes from my c# code with the getTraffic() method

I tried to send the header of a request that I capture and I get this message

Executing action CSharp OwnCode: Récupérer Header Frais.id: 45e7887d-fff0-47fb-86fa-bad6754129c4 Object reference not set to an instance of an object.

C#:
Развернуть Свернуть Копировать
Thread.Sleep(1000);

project.SendInfoToLog("Hey bro", true);

instance.UseTrafficMonitoring = true;

var traffic = instance.ActiveTab.GetTraffic();

foreach (var t in traffic){
    
    
    if(Regex.IsMatch(t.Url, "Check-checkAvailabilityWith")){
        
        
            project.Variables["Header"].Value = t.RequestHeaders;
            project.SendInfoToLog(t.RequestHeaders , true);
        
        
    }
}
 
Everything works fine in the project maker, and t is not empty because I can get the url, only the requestHeader method, causes this problem
Once again, I repeat. this field may be empty, checks are needed. moreover, it is possible that the request does not have this header at all, or it is of a different type, for example responseHeaders. Working with this object requires a lot of checks and a try/catch block.
It is also very possible that the request was not loaded to the end in the Zennoposter, since the speed of work there is much higher than in the Project Maker, where there is an artificial slowdown in the execution of the project. And in your code, this moment is not taken into account, from the word "at all".
 
I understood, unlike the project maker it is necessary to pass instance.UseTrafficMonitoring to true before making the request, I used a "Go to page" block followed by my c# block
 
If someone can explain me why it works like this, is it due to the execution speed in zenoposter, to the precompilation?
 

Вложения

  • Work in zenoposter.png
    Work in zenoposter.png
    337,1 KB · Просмотры: 205
  • Work project maker.png
    Work project maker.png
    384,7 KB · Просмотры: 186
instance.UseTrafficMonitoring = true; this should be before going to the page and doing things with it.
var traffic = instance.ActiveTab.GetTraffic(); Receives and resets all requests

I don't know why you have such a design as in the 2nd picture. It shouldn't work and it doesn't work for me.
 

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