Merge branch 'SciSharp:master' into master
This commit is contained in:
commit
a8e436de5c
|
|
@ -35,6 +35,12 @@ public class ElementActionArgs
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int WaitTime { get; set; }
|
public int WaitTime { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Add current url to the content
|
||||||
|
/// </summary>
|
||||||
|
[JsonPropertyName("show_current_url")]
|
||||||
|
public bool ShowCurrentUrl { get; set; } = false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required for deserialization
|
/// Required for deserialization
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>$(TargetFramework)</TargetFramework>
|
<TargetFramework>$(TargetFramework)</TargetFramework>
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ public class UtilWebActionOnElementFn : IFunctionCallback
|
||||||
}
|
}
|
||||||
|
|
||||||
actionArgs.WaitTime = 2;
|
actionArgs.WaitTime = 2;
|
||||||
|
|
||||||
var conv = _services.GetRequiredService<IConversationService>();
|
var conv = _services.GetRequiredService<IConversationService>();
|
||||||
|
|
||||||
var services = _services.CreateScope().ServiceProvider;
|
var services = _services.CreateScope().ServiceProvider;
|
||||||
|
|
@ -45,7 +45,13 @@ public class UtilWebActionOnElementFn : IFunctionCallback
|
||||||
};
|
};
|
||||||
var result = await browser.ActionOnElement(msg, locatorArgs, actionArgs);
|
var result = await browser.ActionOnElement(msg, locatorArgs, actionArgs);
|
||||||
|
|
||||||
message.Content = $"{actionArgs.Action} executed {(result.IsSuccess ? "success" : "failed")}";
|
message.Content = $"{actionArgs.Action} executed {(result.IsSuccess ? "success" : "failed")}.";
|
||||||
|
|
||||||
|
// Add Current Url info to the message
|
||||||
|
if (actionArgs.ShowCurrentUrl)
|
||||||
|
{
|
||||||
|
message.Content += $" Current page url: '{result.UrlAfterAction}'.";
|
||||||
|
}
|
||||||
|
|
||||||
var path = webDriverService.GetScreenshotFilePath(message.MessageId);
|
var path = webDriverService.GetScreenshotFilePath(message.MessageId);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,16 +16,20 @@
|
||||||
"content": {
|
"content": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "content to input in element"
|
"description": "content to input in element"
|
||||||
},
|
},
|
||||||
"file_urls": {
|
"file_urls": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"description": "The output format must be string array of file urls.",
|
"description": "The output format must be string array of file urls.",
|
||||||
"items": {
|
"items": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "file url"
|
"description": "file url"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"show_current_url": {
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "check if need to extract the current url"
|
||||||
},
|
},
|
||||||
"press_key": {
|
"press_key": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"enum": [ "Enter" ],
|
"enum": [ "Enter" ],
|
||||||
"description": "press key after input text"
|
"description": "press key after input text"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue