Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fix/39660 Web Agent Page Enhancement #3830

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
d:DesignHeight="1200" d:DesignWidth="800"
Title="WebAgentConfigEditPage">

<Grid x:Name="xPageGrid" Grid.IsSharedSizeScope="True" Background="{StaticResource $BackgroundColor_White}">
<Grid x:Name="xPageGrid" Grid.IsSharedSizeScope="True" Background="{StaticResource $BackgroundColor_White}">


<TabControl>
<TabControl >
<TabItem Header="Configurations" Style="{StaticResource $RoundedTab}">
<StackPanel Orientation="Vertical" >
<StackPanel Orientation="Vertical" Margin="5,5,0,0">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
Expand All @@ -35,18 +35,18 @@
<sys:Double x:Key="ControlWidth">270</sys:Double>
<sys:Double x:Key="VEControlWidth">280</sys:Double>
</StackPanel.Resources>
<CheckBox x:Name="xAutoDetectProxyCB" Content="Auto Detect Proxy" Checked="xAutoDetectProxyCB_Checked" Unchecked="xAutoDetectProxyCB_Unchecked_1" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="{StaticResource ChildGap}" Style="{StaticResource $CeckBoxStyle}"/>
<CheckBox x:Name="xAutoDetectProxyCB" Content="Auto Detect Proxy" Click="xAutoDetectProxyCB_Click" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="{StaticResource ChildGap}" Style="{StaticResource $CeckBoxStyle}"/>
<StackPanel x:Name="xProxyPnl">
<StackPanel Orientation="Horizontal" Margin="{StaticResource ChildGap}">
<Label Content="Proxy:" Style="{StaticResource $LabelStyle}" Width="{StaticResource LabelWidth}"/>
<Actions:UCValueExpression x:Name="xProxyVE" Width="{StaticResource VEControlWidth}"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="{StaticResource ChildGap}">
<Label Content="By Pass Local Proxy:" Style="{StaticResource $LabelStyle}" Width="{StaticResource LabelWidth}"/>
<Label Content="By Pass Proxy:" Style="{StaticResource $LabelStyle}" Width="{StaticResource LabelWidth}"/>
<Actions:UCValueExpression x:Name="xByPassProxyVE" Width="{StaticResource VEControlWidth}"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="{StaticResource ChildGap}">
<Label Content="Proxy Auto Config Url:" Style="{StaticResource $LabelStyle}" Width="{StaticResource LabelWidth}"/>
<Label Content="Proxy Auto Config URL:" Style="{StaticResource $LabelStyle}" Width="{StaticResource LabelWidth}"/>
<Actions:UCValueExpression x:Name="xProxyAutoConfigUrlVE" Width="{StaticResource VEControlWidth}"/>
</StackPanel>
</StackPanel>
Expand Down Expand Up @@ -75,9 +75,8 @@

</StackPanel>
<StackPanel Orientation="Horizontal" Margin="{StaticResource ChildGap}">
<Label Content="Browser Version:" Style="{StaticResource $LabelStyle}" Width="{StaticResource LabelWidth}"/>
<Actions:UCValueExpression x:Name="xBrowserVersionVE" Width="{StaticResource VEControlWidth}"/>
</StackPanel>
<CheckBox x:Name="xBrowserPrivateModeCB" Content="Browser Private Mode" Margin="{StaticResource ChildGap}" VerticalAlignment="Center" HorizontalAlignment="Left" Style="{StaticResource $CeckBoxStyle}"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="{StaticResource ChildGap}">
<Label Content="Browser Height:" Style="{StaticResource $LabelStyle}" Width="{StaticResource LabelWidth}"/>
<Actions:UCValueExpression x:Name="xBrowserHeightVE" Width="{StaticResource VEControlWidth}"/>
Expand All @@ -94,8 +93,12 @@
<Label Content="Driver File Path:" Style="{StaticResource $LabelStyle}" Width="{StaticResource LabelWidth}"/>
<Actions:UCValueExpression x:Name="xDriverFilePathVE" Width="{StaticResource VEControlWidth}"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="{StaticResource ChildGap}">
<Label Content="User Profile Folder Path:" Style="{StaticResource $LabelStyle}" Width="{StaticResource LabelWidth}"/>
<Actions:UCValueExpression x:Name="xUserProfileFolderPathVE" Width="{StaticResource VEControlWidth}"/>
</StackPanel>




</StackPanel>

Expand All @@ -105,9 +108,7 @@
</Expander.Header>
<Expander.Content>
<StackPanel Margin="30,5,0,0">
<StackPanel Orientation="Horizontal" Margin="{StaticResource ChildGap}">
<CheckBox x:Name="xBrowserPrivateModeCB" Content="Browser Private Mode" Margin="{StaticResource ChildGap}" VerticalAlignment="Center" HorizontalAlignment="Left" Style="{StaticResource $CeckBoxStyle}"/>
</StackPanel>

<StackPanel x:Name="xChromePnl">
<StackPanel Orientation="Horizontal" Margin="{StaticResource ChildGap}">
<Label Content="Emulation Device Name:" Style="{StaticResource $LabelStyle}" Width="{StaticResource LabelWidth}"/>
Expand All @@ -126,13 +127,13 @@
</StackPanel>

</StackPanel>
<StackPanel x:Name="xChromeFirefoxIEPnl">

<StackPanel x:Name="xAllBrowserNotBravePnl">
<StackPanel Orientation="Horizontal" Margin="{StaticResource ChildGap}">
<Label Content="User Profile Folder Path:" Style="{StaticResource $LabelStyle}" Width="{StaticResource LabelWidth}"/>
<Actions:UCValueExpression x:Name="xUserProfileFolderPathVE" Width="{StaticResource VEControlWidth}"/>
<Label Content="Browser Version:" Style="{StaticResource $LabelStyle}" Width="{StaticResource LabelWidth}"/>
<Actions:UCValueExpression x:Name="xBrowserVersionVE" Width="{StaticResource VEControlWidth}"/>
</StackPanel>
</StackPanel>

<StackPanel x:Name="xEdgeIE">

<StackPanel Orientation="Horizontal" >
Expand All @@ -148,7 +149,7 @@
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="{StaticResource ChildGap}">


<CheckBox x:Name="xEnableNativeEventsCB" Content="Enable Native Events" VerticalAlignment="Center" Margin="{StaticResource ChildGap}" HorizontalAlignment="Left" Style="{StaticResource $CeckBoxStyle}"/>

</StackPanel>
<StackPanel Orientation="Horizontal" Margin="{StaticResource ChildGap}">
Expand Down Expand Up @@ -267,9 +268,8 @@
</StackPanel>

<StackPanel Orientation="Horizontal" Margin="{StaticResource ChildGap}">
<CheckBox x:Name="xDisableExtensionCB" Content="Disable Extension" VerticalAlignment="Center" Margin="{StaticResource ChildGap}" HorizontalAlignment="Left" Style="{StaticResource $CeckBoxStyle}" Width="{StaticResource LabelWidth}"/>

<CheckBox x:Name="xEnableNativeEventsCB" Content="Enable Native Events" VerticalAlignment="Center" Margin="{StaticResource ChildGap}" HorizontalAlignment="Left" Style="{StaticResource $CeckBoxStyle}"/>

</StackPanel>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,16 @@
edgeIEPnlVisibility(browserType);
chromePnlvisibilitly(browserType);
chromeFirefoxPnlVisibility(browserType);
chromeFirefoxIEPnl(browserType);
allBrowserNotBravePnl(browserType);
proxyPnlVisbility();
}

/// <summary>
/// Binds the elements of the page.
/// </summary>
void bindElement()
{

#region ProxyConfigration

//Check if the proxy is auto detect
Expand All @@ -82,10 +83,10 @@
#endregion

#region sessionManagement
//pageLoadStrategy
//pageLoadStrategy
GingerCore.General.FillComboFromEnumType(xPageLoadStrategyComboBox, typeof(SeleniumDriver.ePageLoadStrategy));
DriverConfigParam pageLoadStrategy = mAgent.GetOrCreateParam(nameof(SeleniumDriver.PageLoadStrategy));
BindingHandler.ObjFieldBinding(xPageLoadStrategyComboBox, ComboBox.TextProperty, pageLoadStrategy, nameof(DriverConfigParam.Value));
BindingHandler.ObjFieldBinding(xPageLoadStrategyComboBox, ComboBox.SelectedValueProperty, pageLoadStrategy, nameof(DriverConfigParam.Value));
BindingHandler.ObjFieldBinding(xPageLoadStrategyComboBox, ComboBox.ToolTipProperty, pageLoadStrategy, nameof(DriverConfigParam.Description));

//ImplicitWait
Expand Down Expand Up @@ -195,11 +196,7 @@
BindingHandler.ObjFieldBinding(xOpenIEModeInEdgeCB, CheckBox.IsCheckedProperty, openIEModeInEdge, nameof(DriverConfigParam.Value));
BindingHandler.ObjFieldBinding(xOpenIEModeInEdgeCB, CheckBox.ToolTipProperty, openIEModeInEdge, nameof(DriverConfigParam.Description));

//Edge Executable Path
DriverConfigParam edgeExcutablePath = mAgent.GetOrCreateParam(nameof(SeleniumDriver.EdgeExcutablePath));
xEdgeExcutablePathVE.Init(null, edgeExcutablePath, nameof(DriverConfigParam.Value));
BindingHandler.ObjFieldBinding(xEdgeExcutablePathVE, TextBox.ToolTipProperty, edgeExcutablePath, nameof(DriverConfigParam.Description));



#endregion

Expand Down Expand Up @@ -233,20 +230,15 @@
//Unhandled promt Behavior
GingerCore.General.FillComboFromEnumType(xUnhandledPromptBehaviorComboBox, typeof(SeleniumDriver.eUnhandledPromptBehavior));
DriverConfigParam UnhandledPromptBehavior = mAgent.GetOrCreateParam(nameof(SeleniumDriver.UnhandledPromptBehavior));
BindingHandler.ObjFieldBinding(xUnhandledPromptBehaviorComboBox, ComboBox.TextProperty, UnhandledPromptBehavior, nameof(DriverConfigParam.Value));
BindingHandler.ObjFieldBinding(xUnhandledPromptBehaviorComboBox, ComboBox.SelectedValueProperty, UnhandledPromptBehavior, nameof(DriverConfigParam.Value));
BindingHandler.ObjFieldBinding(xUnhandledPromptBehaviorComboBox, ComboBox.ToolTipProperty, UnhandledPromptBehavior, nameof(DriverConfigParam.Description));

//browser Log Level
GingerCore.General.FillComboFromList(xBrowserLogLevelComboBox, new List<string> { "0", "1", "2", "3", "4" });
GingerCore.General.FillComboFromEnumType(xBrowserLogLevelComboBox, typeof(SeleniumDriver.eBrowserLogLevel));
DriverConfigParam browserLogLevel = mAgent.GetOrCreateParam(nameof(SeleniumDriver.BrowserLogLevel));
BindingHandler.ObjFieldBinding(xBrowserLogLevelComboBox, ComboBox.TextProperty, browserLogLevel, nameof(DriverConfigParam.Value));
BindingHandler.ObjFieldBinding(xBrowserLogLevelComboBox, ComboBox.SelectedValueProperty, browserLogLevel, nameof(DriverConfigParam.Value));
BindingHandler.ObjFieldBinding(xBrowserLogLevelComboBox, ComboBox.ToolTipProperty, browserLogLevel, nameof(DriverConfigParam.Description));

//Disable Extension
DriverConfigParam disableExtension = mAgent.GetOrCreateParam(nameof(SeleniumDriver.DisableExtension));
BindingHandler.ObjFieldBinding(xDisableExtensionCB, CheckBox.IsCheckedProperty, disableExtension, nameof(DriverConfigParam.Value));
BindingHandler.ObjFieldBinding(xDisableExtensionCB, CheckBox.ToolTipProperty, disableExtension, nameof(DriverConfigParam.Description));

//Enable Native Events
DriverConfigParam enableNativeEvents = mAgent.GetOrCreateParam(nameof(SeleniumDriver.EnableNativeEvents));
BindingHandler.ObjFieldBinding(xEnableNativeEventsCB, CheckBox.IsCheckedProperty, enableNativeEvents, nameof(DriverConfigParam.Value));
Expand Down Expand Up @@ -275,6 +267,12 @@


#endregion

if (!string.IsNullOrEmpty(proxyName.Value))
{
autoDetect.Value = "False";
BindingHandler.ObjFieldBinding(xAutoDetectProxyCB, CheckBox.IsCheckedProperty, autoDetect, nameof(DriverConfigParam.Value));
}
}


Expand Down Expand Up @@ -302,8 +300,27 @@
WebBrowserType browserType = Enum.Parse<WebBrowserType>(driverConfigParam.Value);
edgeIEPnlVisibility(browserType);
chromePnlvisibilitly(browserType);
chromeFirefoxPnlVisibility(browserType);
chromeFirefoxIEPnl(browserType);
chromeFirefoxPnlVisibility(browserType);
allBrowserNotBravePnl(browserType);
}

/// <summary>
/// Sets the visibility of the Edge/IE panel based on the specified browser type.
/// </summary>
/// <param name="result">The browser type.</param>
void allBrowserNotBravePnl(WebBrowserType result)
{


if (result == WebBrowserType.Brave|| result == WebBrowserType.InternetExplorer)
{
xAllBrowserNotBravePnl.Visibility = Visibility.Collapsed;
}
else
{
xAllBrowserNotBravePnl.Visibility = Visibility.Visible;
}

}


Expand Down Expand Up @@ -332,7 +349,7 @@
/// <param name="result">The browser type.</param>
void chromePnlvisibilitly(WebBrowserType result)
{
if (result == WebBrowserType.Chrome)
if (result == WebBrowserType.Chrome|| result==WebBrowserType.Brave)
{
xChromePnl.Visibility = Visibility.Visible;
}
Expand All @@ -349,7 +366,7 @@
/// <param name="result">The browser type.</param>
void chromeFirefoxPnlVisibility(WebBrowserType result)
{
if (result == WebBrowserType.Chrome || result == WebBrowserType.FireFox)
if (result == WebBrowserType.Chrome || result == WebBrowserType.FireFox || result == WebBrowserType.Brave)
{
xChromeFirefoxPnl.Visibility = Visibility.Visible;
}
Expand All @@ -361,29 +378,25 @@
/// <summary>
/// Sets the visibility of the Chrome/Firefox/IE panel based on the specified browser type.
/// </summary>
/// <param name="result">The browser type.</param>
void chromeFirefoxIEPnl(WebBrowserType result)
/// <param name="result">The browser type.</param>

void proxyPnlVisbility()
{
if (result == WebBrowserType.Chrome || result == WebBrowserType.FireFox || result == WebBrowserType.InternetExplorer)
if (xAutoDetectProxyCB.IsChecked == false)

Check notice on line 385 in Ginger/Ginger/Drivers/DriversConfigsEditPages/WebAgentConfigEditPage.xaml.cs

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

Ginger/Ginger/Drivers/DriversConfigsEditPages/WebAgentConfigEditPage.xaml.cs#L385

Remove the unnecessary Boolean literal(s).
{
xChromeFirefoxIEPnl.Visibility = Visibility.Visible;
xProxyPnl.IsEnabled = true;
}
else
{
xChromeFirefoxIEPnl.Visibility = Visibility.Collapsed;
xProxyPnl.IsEnabled = false;

}
}
private void xAutoDetectProxyCB_Checked(object sender, RoutedEventArgs e)
{
xProxyPnl.IsEnabled = false;
}

private void xAutoDetectProxyCB_Unchecked_1(object sender, RoutedEventArgs e)
private void xAutoDetectProxyCB_Click(object sender, RoutedEventArgs e)
{
xProxyPnl.IsEnabled = true;
proxyPnlVisbility();
xProxyVE.ValueTextBox.Text = "";
}


}
}

Expand Down
Loading
Loading