Selecting last entry of e.EventData["documentURL"] in a DevTools event listener

24 views Asked by At

I have this method which loops through event data which is being listened to by a DevTools session that has been initiated in my selenium test. This sets my string (_url) to the first instance of "documentURL", but the one I actually need is the last one thats detected, as its the last API call thats fired when the page is loaded. Its the last instance of "documentURL" that I need. Is there a way that I can modify this to put all of these to a list, so I can then select the one I want, or modify it so it only sets my string (_url) to the last instance of "documentURL"?

    static void Session_DevToolsEventReceived(object? sender, DevToolsEventReceivedEventArgs e)
    {
        _url ??= e.EventData["documentURL"]?.ToString();
    }
0

There are 0 answers