diff --git a/SwdPageRecorder/SwdPageRecorder.TestModel/SwdPageRecorder.TestModel.csproj b/SwdPageRecorder/SwdPageRecorder.TestModel/SwdPageRecorder.TestModel.csproj
index 017f616..ad40ba4 100644
--- a/SwdPageRecorder/SwdPageRecorder.TestModel/SwdPageRecorder.TestModel.csproj
+++ b/SwdPageRecorder/SwdPageRecorder.TestModel/SwdPageRecorder.TestModel.csproj
@@ -61,8 +61,8 @@
False
..\packages\TestStack.White.0.13.3\lib\net40\TestStack.White.dll
-
- ..\packages\Selenium.WebDriver.2.51.0\lib\net40\WebDriver.dll
+
+ ..\packages\Selenium.WebDriver.2.53.0\lib\net40\WebDriver.dll
True
diff --git a/SwdPageRecorder/SwdPageRecorder.TestModel/packages.config b/SwdPageRecorder/SwdPageRecorder.TestModel/packages.config
index dd71fb0..92769c7 100644
--- a/SwdPageRecorder/SwdPageRecorder.TestModel/packages.config
+++ b/SwdPageRecorder/SwdPageRecorder.TestModel/packages.config
@@ -3,6 +3,6 @@
-
+
\ No newline at end of file
diff --git a/SwdPageRecorder/SwdPageRecorder.Tests/SwdPageRecorder.Tests.csproj b/SwdPageRecorder/SwdPageRecorder.Tests/SwdPageRecorder.Tests.csproj
index 6c31622..cf1e528 100644
--- a/SwdPageRecorder/SwdPageRecorder.Tests/SwdPageRecorder.Tests.csproj
+++ b/SwdPageRecorder/SwdPageRecorder.Tests/SwdPageRecorder.Tests.csproj
@@ -92,8 +92,8 @@
False
..\packages\TestStack.White.0.13.3\lib\net40\TestStack.White.dll
-
- ..\packages\Selenium.WebDriver.2.51.0\lib\net40\WebDriver.dll
+
+ ..\packages\Selenium.WebDriver.2.53.0\lib\net40\WebDriver.dll
True
diff --git a/SwdPageRecorder/SwdPageRecorder.Tests/packages.config b/SwdPageRecorder/SwdPageRecorder.Tests/packages.config
index f0a383e..831802d 100644
--- a/SwdPageRecorder/SwdPageRecorder.Tests/packages.config
+++ b/SwdPageRecorder/SwdPageRecorder.Tests/packages.config
@@ -5,6 +5,6 @@
-
+
\ No newline at end of file
diff --git a/SwdPageRecorder/SwdPageRecorder.UI/SwdMain/SwdMainPresenter.cs b/SwdPageRecorder/SwdPageRecorder.UI/SwdMain/SwdMainPresenter.cs
index 41961be..283ac53 100644
--- a/SwdPageRecorder/SwdPageRecorder.UI/SwdMain/SwdMainPresenter.cs
+++ b/SwdPageRecorder/SwdPageRecorder.UI/SwdMain/SwdMainPresenter.cs
@@ -200,11 +200,14 @@ public void ProcessCommands()
simpleFrame = new SimpleFrame(-1, "noFrameChosen", "noFrameChosen", "noFrameChosen", null);
}
+ bool emptyHtmlId = String.IsNullOrEmpty(addElementCommand.ElementId);
var element = new WebElementDefinition()
{
Name = addElementCommand.ElementCodeName,
- HowToSearch = LocatorSearchMethod.XPath,
- Locator = addElementCommand.ElementXPath,
+ HtmlId = addElementCommand.ElementId,
+ Xpath = addElementCommand.ElementXPath,
+ HowToSearch = (emptyHtmlId) ? LocatorSearchMethod.XPath: LocatorSearchMethod.Id,
+ Locator = (emptyHtmlId) ? addElementCommand.ElementXPath: addElementCommand.ElementId,
CssSelector = addElementCommand.ElementCssSelector,
frame = simpleFrame,
};
diff --git a/SwdPageRecorder/SwdPageRecorder.UI/SwdMain/SwdMainView.Designer.cs b/SwdPageRecorder/SwdPageRecorder.UI/SwdMain/SwdMainView.Designer.cs
index d39d867..b248ff5 100644
--- a/SwdPageRecorder/SwdPageRecorder.UI/SwdMain/SwdMainView.Designer.cs
+++ b/SwdPageRecorder/SwdPageRecorder.UI/SwdMain/SwdMainView.Designer.cs
@@ -34,6 +34,7 @@ private void InitializeComponent()
this.btnOpenBrowserPreview = new System.Windows.Forms.Button();
this.btnOpenScreenshotFolder = new System.Windows.Forms.Button();
this.btnTakePageScreenshot = new System.Windows.Forms.Button();
+ this.linkLabel1 = new System.Windows.Forms.LinkLabel();
this.btnBrowser_Go = new System.Windows.Forms.Button();
this.txtBrowserUrl = new System.Windows.Forms.TextBox();
this.pnlLoadingBar = new System.Windows.Forms.Panel();
@@ -70,7 +71,6 @@ private void InitializeComponent()
this.tabPage6 = new System.Windows.Forms.TabPage();
this.playGroundView1 = new SwdPageRecorder.UI.PlayGroundView();
this.pageObjectDefinitionView = new SwdPageRecorder.UI.PageObjectDefinitionView();
- this.linkLabel1 = new System.Windows.Forms.LinkLabel();
this.groupBox1.SuspendLayout();
this.pnlLoadingBar.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
@@ -141,6 +141,18 @@ private void InitializeComponent()
this.btnTakePageScreenshot.UseVisualStyleBackColor = true;
this.btnTakePageScreenshot.Click += new System.EventHandler(this.btnTakePageScreenshot_Click);
//
+ // linkLabel1
+ //
+ this.linkLabel1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+ this.linkLabel1.AutoSize = true;
+ this.linkLabel1.Location = new System.Drawing.Point(868, 18);
+ this.linkLabel1.Name = "linkLabel1";
+ this.linkLabel1.Size = new System.Drawing.Size(116, 13);
+ this.linkLabel1.TabIndex = 2;
+ this.linkLabel1.TabStop = true;
+ this.linkLabel1.Text = "Visit project\'s home site";
+ this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked);
+ //
// btnBrowser_Go
//
this.btnBrowser_Go.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
@@ -536,18 +548,6 @@ private void InitializeComponent()
this.pageObjectDefinitionView.Size = new System.Drawing.Size(244, 420);
this.pageObjectDefinitionView.TabIndex = 2;
//
- // linkLabel1
- //
- this.linkLabel1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.linkLabel1.AutoSize = true;
- this.linkLabel1.Location = new System.Drawing.Point(868, 18);
- this.linkLabel1.Name = "linkLabel1";
- this.linkLabel1.Size = new System.Drawing.Size(116, 13);
- this.linkLabel1.TabIndex = 2;
- this.linkLabel1.TabStop = true;
- this.linkLabel1.Text = "Visit project\'s home site";
- this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked);
- //
// SwdMainView
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
diff --git a/SwdPageRecorder/SwdPageRecorder.UI/SwdMain/SwdMainView.resx b/SwdPageRecorder/SwdPageRecorder.UI/SwdMain/SwdMainView.resx
index 94100c3..15afbb0 100644
--- a/SwdPageRecorder/SwdPageRecorder.UI/SwdMain/SwdMainView.resx
+++ b/SwdPageRecorder/SwdPageRecorder.UI/SwdMain/SwdMainView.resx
@@ -123,29 +123,31 @@
- iVBORw0KGgoAAAANSUhEUgAAABUAAAAYCAIAAACa6yEfAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
- YQUAAAAJcEhZcwAADrwAAA68AZW8ckkAAARLSURBVDhPhdJ7TFpXHAfwsyxZsixZsizZmrRpVayCUhAF
- 8QnamqZLk3bLkjVdsu2P7Y+tyUyWJqUtW9dNXevbivjgcUFBUFSU1ke3uU5d5wNctMps4wsfSIvK4wIX
- Llpzd8CrVtdlJ9+Qc87v++EkBPBAIvjf/FZ3MLsj0CcVEC4BQZT9V7a2SjY3i4PBIhwPBW7gEV6GpoPn
- wIBMYCp7J9ib89IEfjnlu3/S1Zlt7+Db2ngwcOO8l+3tOQlHys9B2Be/Hfw5+9/B72f5uviODh46Kdvw
- WDewVXShb1abY21Odxp4cKT4DICHcoGp8K0Q6OGHsrvp4fs7eaghE30kJl5Ylt7vp5XcZ7o0jyET+QSA
- ISTsd8yLwTp5zvYM9LGWpASxEUBNivNmGceqTXV3ZOz4n94MdmaEDPzcCX4vHTOkO1pSF7XZK8NVK+Mt
- MwM1/VU5f5Yx/5YkrTRyUX0a8jEAIwqBKe+NoCH1QALtKd5W7ro2eUGRNCFOGCw50Xeb/rCYPiZizskT
- V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IcsDta2+4qzAEw17vNwbBFRcbeV1AQx2aeRf3m4+2rEeGH0kpgKHzjoRy6D
+ QH2cH4nxIjR7bazV8BVJw6s573zDpcO/Xj82UUhZEsU4JFRY8ytpkCBnAHiiFYx8AwKKWOhRaYytKtpl
+ 7iApQWxtPb/z6bvtQvZ0d35gfe6p7sJq9XFYw+QxkCCnd70sGnq35PhyeSTusJA6vDC3fRPHlgcVU+LM
+ +XKKvToa1vb8dJNgJDfkMQnFVRMFfdC9QtLQ32ZmVF/QfZX6h/CIueDoQmmEXRSF1lJgGRLkFACzO94v
+ pcCB7U7kfP0Hlt5S8938rryspkuH7uYe6rt2ZOzHozNFESsVkQ5xlKeWAst7HskCMHI+kPJAdQYoSwUF
+ HPBdIrjOAkIWuJkIbiWD0lRQmQ5qMoGEB2T8UD+ULPAPM7qx9cULW8UAAAAASUVORK5CYII=
+
+ 25
+
AAABAAEAQEAAAAEAIAAoQgAAFgAAACgAAABAAAAAgAAAAAEAIAAAAAAAAEAAACcAAAAnAAAAAAAAAAAA
diff --git a/SwdPageRecorder/SwdPageRecorder.UI/SwdMain/Tabs/PageObjectDefinitionView.cs b/SwdPageRecorder/SwdPageRecorder.UI/SwdMain/Tabs/PageObjectDefinitionView.cs
index 9d6698f..a957f83 100644
--- a/SwdPageRecorder/SwdPageRecorder.UI/SwdMain/Tabs/PageObjectDefinitionView.cs
+++ b/SwdPageRecorder/SwdPageRecorder.UI/SwdMain/Tabs/PageObjectDefinitionView.cs
@@ -112,6 +112,23 @@ internal void UpdateExistingPageDefinition(TreeNode existingNode, WebElementDefi
}
}
+ internal void DeleteExistingElementFromPage(TreeNode existingNode) {
+
+ var action = (MethodInvoker)delegate
+ {
+ tvWebElements.Nodes[0].Nodes.Remove(existingNode);
+ };
+
+ if (tvWebElements.InvokeRequired)
+ {
+ tvWebElements.Invoke(action);
+ }
+ else
+ {
+ action();
+ }
+ }
+
internal void UpdateLastCallStat(string elapsedTime)
{
lblLastCallTime.DoInvokeAction(() =>
diff --git a/SwdPageRecorder/SwdPageRecorder.UI/SwdMain/Tabs/Presenters/PageObjectDefinitionPresenter.cs b/SwdPageRecorder/SwdPageRecorder.UI/SwdMain/Tabs/Presenters/PageObjectDefinitionPresenter.cs
index dc6fcc2..b0c6e20 100644
--- a/SwdPageRecorder/SwdPageRecorder.UI/SwdMain/Tabs/Presenters/PageObjectDefinitionPresenter.cs
+++ b/SwdPageRecorder/SwdPageRecorder.UI/SwdMain/Tabs/Presenters/PageObjectDefinitionPresenter.cs
@@ -101,6 +101,27 @@ internal void UpdatePageDefinition(WebElementDefinition element, bool forceAddNe
}
}
+ internal void removeElementFromObjectPage(WebElementDefinition element)
+ {
+ if (_isEditingExistingNode)
+ {
+ DialogResult dr = MessageBox.Show("Do you want to remove the element which is named as "+ _currentEditingNode.Text + "?", "Attention", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
+ if (dr == DialogResult.Yes)
+ {
+ view.DeleteExistingElementFromPage(_currentEditingNode);
+ NotifyOnChanges();
+ }
+ else
+ {
+ return;
+ }
+ }
+ else
+ {
+ MessageBox.Show("Can not remove if element hasn't been ever saved. ", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ }
+ }
+
internal void OpenExistingNodeForEdit(TreeNode treeNode)
{
diff --git a/SwdPageRecorder/SwdPageRecorder.UI/SwdMain/Tabs/Presenters/SelectorsEditPresenter.cs b/SwdPageRecorder/SwdPageRecorder.UI/SwdMain/Tabs/Presenters/SelectorsEditPresenter.cs
index 43573b9..13f7691 100644
--- a/SwdPageRecorder/SwdPageRecorder.UI/SwdMain/Tabs/Presenters/SelectorsEditPresenter.cs
+++ b/SwdPageRecorder/SwdPageRecorder.UI/SwdMain/Tabs/Presenters/SelectorsEditPresenter.cs
@@ -74,6 +74,11 @@ internal void CopyWebElement()
view.AppendWebElementNameWith("__Copy");
}
+ internal void RemoveWebElement(WebElementDefinition element)
+ {
+ Presenters.PageObjectDefinitionPresenter.removeElementFromObjectPage(element);
+ }
+
internal void HighLightWebElement(WebElementDefinition element)
{
if (!IsValidForm()) return;
@@ -89,6 +94,7 @@ internal void OpenExistingNodeForEdit(TreeNode treeNode)
Presenters.PageObjectDefinitionPresenter._currentEditingNode = treeNode;
var webElementFormData = treeNode.Tag as WebElementDefinition;
view.UpdateWebElementForm(webElementFormData);
+ view.btnRemoveWebElement.Enabled = true;
}
internal LocatorSearchMethod GetLocatorSearchMethod()
diff --git a/SwdPageRecorder/SwdPageRecorder.UI/SwdMain/Tabs/SelectorsEditView.Designer.cs b/SwdPageRecorder/SwdPageRecorder.UI/SwdMain/Tabs/SelectorsEditView.Designer.cs
index 7c7fa1e..bf3ccdb 100644
--- a/SwdPageRecorder/SwdPageRecorder.UI/SwdMain/Tabs/SelectorsEditView.Designer.cs
+++ b/SwdPageRecorder/SwdPageRecorder.UI/SwdMain/Tabs/SelectorsEditView.Designer.cs
@@ -28,7 +28,9 @@ protected override void Dispose(bool disposing)
///
private void InitializeComponent()
{
+ this.components = new System.ComponentModel.Container();
this.groupBox2 = new System.Windows.Forms.GroupBox();
+ this.btnRemoveWebElement = new System.Windows.Forms.Button();
this.pnlLocatorEditContainer = new System.Windows.Forms.Panel();
this.txtHtmlElementFrameId = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
@@ -64,6 +66,7 @@ private void InitializeComponent()
this.btnHighlightWebElementInBrowser = new System.Windows.Forms.Button();
this.btnNewWebElement = new System.Windows.Forms.Button();
this.btnUpdateDeclaration = new System.Windows.Forms.Button();
+ this.timer = new System.Windows.Forms.Timer(this.components);
this.groupBox2.SuspendLayout();
this.pnlLocatorEditContainer.SuspendLayout();
this.groupBox1.SuspendLayout();
@@ -75,6 +78,7 @@ private void InitializeComponent()
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox2.BackColor = System.Drawing.SystemColors.Control;
+ this.groupBox2.Controls.Add(this.btnRemoveWebElement);
this.groupBox2.Controls.Add(this.pnlLocatorEditContainer);
this.groupBox2.Controls.Add(this.btnReadElementProperties);
this.groupBox2.Controls.Add(this.btnCopyWebElement);
@@ -88,6 +92,18 @@ private void InitializeComponent()
this.groupBox2.TabStop = false;
this.groupBox2.Text = "WebElement";
//
+ // btnRemoveWebElement
+ //
+ this.btnRemoveWebElement.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+ this.btnRemoveWebElement.Location = new System.Drawing.Point(661, 66);
+ this.btnRemoveWebElement.Name = "btnRemoveWebElement";
+ this.btnRemoveWebElement.Enabled = false;
+ this.btnRemoveWebElement.Size = new System.Drawing.Size(85, 23);
+ this.btnRemoveWebElement.TabIndex = 20;
+ this.btnRemoveWebElement.Text = "Remove";
+ this.btnRemoveWebElement.UseVisualStyleBackColor = true;
+ this.btnRemoveWebElement.Click += new System.EventHandler(this.btnRemoveWebElement_Click);
+ //
// pnlLocatorEditContainer
//
this.pnlLocatorEditContainer.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
@@ -158,7 +174,7 @@ private void InitializeComponent()
this.txtCssSelector.Font = new System.Drawing.Font("Lucida Console", 9.75F);
this.txtCssSelector.Location = new System.Drawing.Point(135, 57);
this.txtCssSelector.Name = "txtCssSelector";
- this.txtCssSelector.Size = new System.Drawing.Size(496, 20);
+ this.txtCssSelector.Size = new System.Drawing.Size(462, 20);
this.txtCssSelector.TabIndex = 3;
this.txtCssSelector.Enter += new System.EventHandler(this.txtCssSelector_Enter);
//
@@ -166,7 +182,7 @@ private void InitializeComponent()
//
this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.button2.Enabled = false;
- this.button2.Location = new System.Drawing.Point(584, 272);
+ this.button2.Location = new System.Drawing.Point(550, 272);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(47, 23);
this.button2.TabIndex = 20;
@@ -187,7 +203,7 @@ private void InitializeComponent()
this.label9.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.label9.AutoSize = true;
this.label9.Enabled = false;
- this.label9.Location = new System.Drawing.Point(332, 255);
+ this.label9.Location = new System.Drawing.Point(298, 255);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(122, 13);
this.label9.TabIndex = 19;
@@ -208,7 +224,7 @@ private void InitializeComponent()
this.textBox7.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.textBox7.Enabled = false;
this.textBox7.Font = new System.Drawing.Font("Lucida Console", 9.75F);
- this.textBox7.Location = new System.Drawing.Point(335, 275);
+ this.textBox7.Location = new System.Drawing.Point(301, 275);
this.textBox7.Name = "textBox7";
this.textBox7.Size = new System.Drawing.Size(238, 20);
this.textBox7.TabIndex = 12;
@@ -261,7 +277,7 @@ private void InitializeComponent()
this.txtOtherLocator.Font = new System.Drawing.Font("Lucida Console", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.txtOtherLocator.Location = new System.Drawing.Point(135, 108);
this.txtOtherLocator.Name = "txtOtherLocator";
- this.txtOtherLocator.Size = new System.Drawing.Size(496, 20);
+ this.txtOtherLocator.Size = new System.Drawing.Size(462, 20);
this.txtOtherLocator.TabIndex = 5;
this.txtOtherLocator.Enter += new System.EventHandler(this.txtOtherLocator_Enter);
//
@@ -281,7 +297,7 @@ private void InitializeComponent()
this.txtXPath.Font = new System.Drawing.Font("Lucida Console", 9.75F);
this.txtXPath.Location = new System.Drawing.Point(135, 80);
this.txtXPath.Name = "txtXPath";
- this.txtXPath.Size = new System.Drawing.Size(496, 20);
+ this.txtXPath.Size = new System.Drawing.Size(462, 20);
this.txtXPath.TabIndex = 4;
this.txtXPath.Enter += new System.EventHandler(this.txtXPath_Enter);
//
@@ -302,7 +318,7 @@ private void InitializeComponent()
this.txtHtmlId.Font = new System.Drawing.Font("Lucida Console", 9.75F);
this.txtHtmlId.Location = new System.Drawing.Point(135, 32);
this.txtHtmlId.Name = "txtHtmlId";
- this.txtHtmlId.Size = new System.Drawing.Size(496, 20);
+ this.txtHtmlId.Size = new System.Drawing.Size(462, 20);
this.txtHtmlId.TabIndex = 2;
this.txtHtmlId.Enter += new System.EventHandler(this.txtHtmlId_Enter);
//
@@ -315,7 +331,7 @@ private void InitializeComponent()
this.groupBox1.Controls.Add(this.label4);
this.groupBox1.Controls.Add(this.txtPropArg1);
this.groupBox1.Controls.Add(this.label3);
- this.groupBox1.Location = new System.Drawing.Point(335, 161);
+ this.groupBox1.Location = new System.Drawing.Point(301, 161);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(302, 91);
this.groupBox1.TabIndex = 13;
@@ -386,7 +402,7 @@ private void InitializeComponent()
this.txtWebElementName.Font = new System.Drawing.Font("Lucida Console", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.txtWebElementName.Location = new System.Drawing.Point(135, 6);
this.txtWebElementName.Name = "txtWebElementName";
- this.txtWebElementName.Size = new System.Drawing.Size(496, 20);
+ this.txtWebElementName.Size = new System.Drawing.Size(462, 20);
this.txtWebElementName.TabIndex = 1;
//
// txtPropHtmlTag
@@ -421,7 +437,7 @@ private void InitializeComponent()
// btnReadElementProperties
//
this.btnReadElementProperties.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.btnReadElementProperties.Location = new System.Drawing.Point(660, 109);
+ this.btnReadElementProperties.Location = new System.Drawing.Point(661, 120);
this.btnReadElementProperties.Name = "btnReadElementProperties";
this.btnReadElementProperties.Size = new System.Drawing.Size(85, 23);
this.btnReadElementProperties.TabIndex = 18;
@@ -443,7 +459,7 @@ private void InitializeComponent()
// btnHighlightWebElementInBrowser
//
this.btnHighlightWebElementInBrowser.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.btnHighlightWebElementInBrowser.Location = new System.Drawing.Point(660, 75);
+ this.btnHighlightWebElementInBrowser.Location = new System.Drawing.Point(661, 92);
this.btnHighlightWebElementInBrowser.Name = "btnHighlightWebElementInBrowser";
this.btnHighlightWebElementInBrowser.Size = new System.Drawing.Size(85, 23);
this.btnHighlightWebElementInBrowser.TabIndex = 15;
@@ -492,6 +508,7 @@ private void InitializeComponent()
#endregion
+ public System.Windows.Forms.Timer timer;
public System.Windows.Forms.GroupBox groupBox2;
public System.Windows.Forms.Button btnCopyWebElement;
public System.Windows.Forms.Button btnHighlightWebElementInBrowser;
@@ -528,5 +545,6 @@ private void InitializeComponent()
public System.Windows.Forms.TextBox txtHtmlElementFrameId;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Panel pnlLocatorEditContainer;
+ public System.Windows.Forms.Button btnRemoveWebElement;
}
}
diff --git a/SwdPageRecorder/SwdPageRecorder.UI/SwdMain/Tabs/SelectorsEditView.cs b/SwdPageRecorder/SwdPageRecorder.UI/SwdMain/Tabs/SelectorsEditView.cs
index b507406..44e2f2b 100644
--- a/SwdPageRecorder/SwdPageRecorder.UI/SwdMain/Tabs/SelectorsEditView.cs
+++ b/SwdPageRecorder/SwdPageRecorder.UI/SwdMain/Tabs/SelectorsEditView.cs
@@ -81,12 +81,25 @@ private void btnCopyWebElement_Click(object sender, EventArgs e)
private void btnHighlightWebElementInBrowser_Click(object sender, EventArgs e)
{
+ timer.Interval = 500; // here time in milliseconds
+ timer.Tick += timer_Tick;
+ timer.Start();
+ btnHighlightWebElementInBrowser.Enabled = false;
+
var element = GetWebElementDefinitionFromForm();
presenter.HighLightWebElement(element);
+
+ }
+
+ void timer_Tick(object sender, System.EventArgs e)
+ {
+ btnHighlightWebElementInBrowser.Enabled = true;
+ timer.Stop();
}
private void btnUpdateDeclaration_Click(object sender, EventArgs e)
{
+
var element = GetWebElementDefinitionFromForm();
Presenters.PageObjectDefinitionPresenter.UpdatePageDefinition(element);
}
@@ -97,6 +110,9 @@ public WebElementDefinition GetWebElementDefinitionFromForm()
var element = new WebElementDefinition()
{
Name = txtWebElementName.Text,
+ HtmlId = txtHtmlId.Text,
+ CssSelector = txtCssSelector.Text,
+ Xpath = txtXPath.Text,
HowToSearch = GetLocatorSearchMethod(),
Locator = GetLocatorText(),
@@ -156,6 +172,7 @@ internal void ClearWebElementForm()
chkReturnsListOfWebElements.Checked = false;
+ btnRemoveWebElement.Enabled = false;
}
internal void AppendWebElementNameWith(string appendWithStr)
@@ -231,8 +248,10 @@ internal void UpdateWebElementForm(WebElementDefinition formData)
ClearWebElementForm();
txtWebElementName.Text = formData.Name;
- // Fill with the formData
- txtCssSelector.Text = formData.CssSelector;
+ // Fill with the formData
+ txtCssSelector.Text = formData.CssSelector;
+ txtHtmlId.Text = formData.HtmlId;
+ txtXPath.Text = formData.Xpath;
switch (formData.HowToSearch)
@@ -284,5 +303,30 @@ internal void DisplayWarningMessage(string message)
{
MessageBox.Show(message, "Yo! (SWD Page Recorder)", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
+
+ internal void DisableHighlightWebElementInBrowserButton()
+ {
+ btnHighlightWebElementInBrowser.DoInvokeAction(() =>
+ {
+ btnHighlightWebElementInBrowser.Enabled = false;
+
+ });
+ }
+
+ internal void EnableHighlightWebElementInBrowserButton()
+ {
+ btnHighlightWebElementInBrowser.DoInvokeAction(() =>
+ {
+ btnHighlightWebElementInBrowser.Enabled = true;
+
+ });
+ }
+
+ private void btnRemoveWebElement_Click(object sender, EventArgs e)
+ {
+ var element = GetWebElementDefinitionFromForm();
+ presenter.RemoveWebElement(element);
+ presenter.NewWebElement();
+ }
}
}
diff --git a/SwdPageRecorder/SwdPageRecorder.UI/SwdMain/Tabs/SelectorsEditView.resx b/SwdPageRecorder/SwdPageRecorder.UI/SwdMain/Tabs/SelectorsEditView.resx
index 1af7de1..e22c5ac 100644
--- a/SwdPageRecorder/SwdPageRecorder.UI/SwdMain/Tabs/SelectorsEditView.resx
+++ b/SwdPageRecorder/SwdPageRecorder.UI/SwdMain/Tabs/SelectorsEditView.resx
@@ -117,4 +117,7 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ 17, 17
+
\ No newline at end of file
diff --git a/SwdPageRecorder/SwdPageRecorder.UI/SwdPageRecorder.UI.csproj b/SwdPageRecorder/SwdPageRecorder.UI/SwdPageRecorder.UI.csproj
index a0e0f37..a61ae81 100644
--- a/SwdPageRecorder/SwdPageRecorder.UI/SwdPageRecorder.UI.csproj
+++ b/SwdPageRecorder/SwdPageRecorder.UI/SwdPageRecorder.UI.csproj
@@ -114,8 +114,8 @@
-
- ..\packages\Selenium.WebDriver.2.51.0\lib\net40\WebDriver.dll
+
+ ..\packages\Selenium.WebDriver.2.53.0\lib\net40\WebDriver.dll
True
diff --git a/SwdPageRecorder/SwdPageRecorder.UI/packages.config b/SwdPageRecorder/SwdPageRecorder.UI/packages.config
index 89e99b2..049ebc2 100644
--- a/SwdPageRecorder/SwdPageRecorder.UI/packages.config
+++ b/SwdPageRecorder/SwdPageRecorder.UI/packages.config
@@ -6,5 +6,5 @@
-
+
\ No newline at end of file
diff --git a/SwdPageRecorder/SwdPageRecorder.WebDriver/JavaScript/ElementSearch.js b/SwdPageRecorder/SwdPageRecorder.WebDriver/JavaScript/ElementSearch.js
index 6171c49..a0ab67e 100644
--- a/SwdPageRecorder/SwdPageRecorder.WebDriver/JavaScript/ElementSearch.js
+++ b/SwdPageRecorder/SwdPageRecorder.WebDriver/JavaScript/ElementSearch.js
@@ -345,9 +345,10 @@ getElementId = function(element) {
};
SWD_Page_Recorder.prototype.addElement = function() {
- var JsonData, XPathLocatorElement, codeIDTextElement;
+ var JsonData, XPathLocatorElement, codeIDTextElement, htmlIdElement;
hello("addElement");
codeIDTextElement = document.getElementById("SwdPR_PopUp_CodeIDText");
+ htmlIdElement = document.getElementById("SwdPR_PopUp_ElementId");
CssSelectorElement = document.getElementById("SwdPR_PopUp_CssSelector");
XPathLocatorElement = document.getElementById("SwdPR_PopUp_XPathLocator");
JsonData = {
@@ -355,6 +356,7 @@ getElementId = function(element) {
"Caller": "addElement",
"CommandId": pseudoGuid(),
"ElementCodeName": codeIDTextElement.value,
+ "ElementId": (htmlIdElement.hasChildNodes())?htmlIdElement.firstChild.nodeValue:"",
"ElementCssSelector": CssSelectorElement.firstChild.nodeValue,
"ElementXPath": XPathLocatorElement.firstChild.nodeValue
};
diff --git a/SwdPageRecorder/SwdPageRecorder.WebDriver/JsCommand/AddElement.cs b/SwdPageRecorder/SwdPageRecorder.WebDriver/JsCommand/AddElement.cs
index 75b3288..b946c97 100644
--- a/SwdPageRecorder/SwdPageRecorder.WebDriver/JsCommand/AddElement.cs
+++ b/SwdPageRecorder/SwdPageRecorder.WebDriver/JsCommand/AddElement.cs
@@ -7,6 +7,7 @@ namespace SwdPageRecorder.WebDriver.JsCommand
{
public class AddElement : BrowserCommand
{
+ public string ElementId { get; set; }
public string ElementCodeName {get; set;}
public string ElementXPath { get; set; }
public string ElementCssSelector { get; set; }
diff --git a/SwdPageRecorder/SwdPageRecorder.WebDriver/SwdPageRecorder.WebDriver.csproj b/SwdPageRecorder/SwdPageRecorder.WebDriver/SwdPageRecorder.WebDriver.csproj
index 155e11c..0052911 100644
--- a/SwdPageRecorder/SwdPageRecorder.WebDriver/SwdPageRecorder.WebDriver.csproj
+++ b/SwdPageRecorder/SwdPageRecorder.WebDriver/SwdPageRecorder.WebDriver.csproj
@@ -78,8 +78,8 @@
-
- ..\packages\Selenium.WebDriver.2.51.0\lib\net40\WebDriver.dll
+
+ ..\packages\Selenium.WebDriver.2.53.0\lib\net40\WebDriver.dll
True
diff --git a/SwdPageRecorder/SwdPageRecorder.WebDriver/WebElementDefinition.cs b/SwdPageRecorder/SwdPageRecorder.WebDriver/WebElementDefinition.cs
index e90549c..1b5a2c6 100644
--- a/SwdPageRecorder/SwdPageRecorder.WebDriver/WebElementDefinition.cs
+++ b/SwdPageRecorder/SwdPageRecorder.WebDriver/WebElementDefinition.cs
@@ -23,6 +23,12 @@ public class WebElementDefinition
[DisplayName("Locator")]
public string Locator { get; set; }
+ [DisplayName("Id")]
+ public string HtmlId { get; set; }
+
+ [DisplayName("Xpath")]
+ public string Xpath { get; set; }
+
[Browsable(false)]
public string HtmlTag { get; set; }
@@ -88,13 +94,32 @@ public string Type
}
}
+ [Browsable(false)]
+ [XmlIgnore]
+ public string HtmlClass
+ {
+ get
+ {
+ var htmlClass = string.Empty;
+
+ if (AllHtmlTagProperties.ContainsKey("class"))
+ {
+ htmlClass = AllHtmlTagProperties["class"];
+ }
+
+ return htmlClass;
+ }
+ }
+
public WebElementDefinition Clone()
{
var clone = new WebElementDefinition()
{
Name = Name,
+ HtmlId = HtmlId,
Locator = Locator,
CssSelector = CssSelector,
+ Xpath = Xpath,
HowToSearch = HowToSearch,
HtmlTag = HtmlTag,
ReturnsCollection = ReturnsCollection,
diff --git a/SwdPageRecorder/SwdPageRecorder.WebDriver/packages.config b/SwdPageRecorder/SwdPageRecorder.WebDriver/packages.config
index 372e0a9..490950c 100644
--- a/SwdPageRecorder/SwdPageRecorder.WebDriver/packages.config
+++ b/SwdPageRecorder/SwdPageRecorder.WebDriver/packages.config
@@ -3,5 +3,5 @@
-
+
\ No newline at end of file