File tree Expand file tree Collapse file tree 4 files changed +14
-4
lines changed
Infrastructure/BotSharp.Abstraction/Browsing/Settings
Plugins/BotSharp.Plugin.WebDriver Expand file tree Collapse file tree 4 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -4,4 +4,6 @@ public class WebBrowsingSettings
44{
55 public string Driver { get ; set ; } = "Playwright" ;
66 public bool Headless { get ; set ; }
7+ // Default timeout in milliseconds
8+ public float DefaultTimeout { get ; set ; } = 30000 ;
79}
Original file line number Diff line number Diff line change 1+ using BotSharp . Abstraction . Browsing . Settings ;
2+
13namespace BotSharp . Plugin . WebDriver . Functions ;
24
35public class GoToPageFn : IFunctionCallback
@@ -25,15 +27,16 @@ public async Task<bool> Execute(RoleDialogModel message)
2527 var url = webDriverService . ReplaceToken ( args . Url ) ;
2628
2729 url = url . Replace ( "https://https://" , "https://" ) ;
28-
30+ var _webDriver = _services . GetRequiredService < WebBrowsingSettings > ( ) ;
2931 var result = await _browser . GoToPage ( new MessageInfo
3032 {
3133 AgentId = message . CurrentAgentId ,
3234 ContextId = convService . ConversationId ,
3335 MessageId = message . MessageId
3436 } , new PageActionArgs
3537 {
36- Url = url
38+ Url = url ,
39+ Timeout = _webDriver . DefaultTimeout
3740 } ) ;
3841 message . Content = result . IsSuccess ? $ "Page { url } is open." : $ "Page { url } open failed. { result . Message } ";
3942
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ public async Task<bool> Execute(RoleDialogModel message)
2626
2727 var webDriverService = _services . GetRequiredService < WebDriverService > ( ) ;
2828 var url = webDriverService . ReplaceToken ( args . Url ) ;
29-
29+ var _webDriver = _services . GetRequiredService < WebBrowsingSettings > ( ) ;
3030 url = url . Replace ( "https://https://" , "https://" ) ;
3131 var msgInfo = new MessageInfo
3232 {
@@ -40,7 +40,8 @@ public async Task<bool> Execute(RoleDialogModel message)
4040 } ) ;
4141 result = await _browser . GoToPage ( msgInfo , new PageActionArgs
4242 {
43- Url = url
43+ Url = url ,
44+ Timeout = _webDriver . DefaultTimeout
4445 } ) ;
4546
4647 if ( result . IsSuccess )
Original file line number Diff line number Diff line change 1+ using BotSharp . Abstraction . Browsing . Settings ;
2+
13namespace BotSharp . Plugin . WebDriver . UtilFunctions ;
24
35public class UtilWebGoToPageFn : IFunctionCallback
@@ -21,6 +23,8 @@ public async Task<bool> Execute(RoleDialogModel message)
2123 {
2224 PropertyNamingPolicy = JsonNamingPolicy . CamelCase
2325 } ) ;
26+ var _webDriver = _services . GetRequiredService < WebBrowsingSettings > ( ) ;
27+ args . Timeout = _webDriver . DefaultTimeout ;
2428 args . WaitForNetworkIdle = false ;
2529 args . WaitTime = 5 ;
2630 args . OpenNewTab = true ;
You can’t perform that action at this time.
0 commit comments