Related
I am using Selenium IDE 3.17.2 on Chrome 106.0.5249.62, to write test login for a Citrix page.
The first time you log into Citrix Workspace, it prompts you have to click a button/link "Detect Citrix Workspace app":
In the IDE, I can click the button just fine, but the next time the test runs, that button will no longer be presented, so I am trying to check for it. If I find it, click it (and click another link afterwards), if not assume we are logged in and look for the logoff button. After some searching, I settled on "store xpath count" to detect the button. That works great, but then I discovered that the element is always on the page, even if the button is not visible:
Now I have no idea what to do. Below is my test (with the URL, username, and password obfiscated), any ideas?
{
"id": "4ad6c3fa-d1a6-4904-8044-8c24afddcbc2",
"version": "2.0",
"name": "Login",
"url": "https://myurl.com",
"tests": [{
"id": "b4bc2240-d614-4924-bb6c-a6b6bfec2012",
"name": "Login",
"commands": [{
"id": "508e91e8-46de-44cf-9f79-18fbfe3bf6e0",
"comment": "",
"command": "open",
"target": "/index.html",
"targets": [],
"value": ""
}, {
"id": "04950822-f2ca-4bbc-8b11-93ae6370d3f6",
"comment": "",
"command": "waitForElementPresent",
"target": "id=Enter user name",
"targets": [],
"value": "30000"
}, {
"id": "38285c96-1015-437f-b0d4-b5dcaca7a7c6",
"comment": "",
"command": "type",
"target": "id=Enter user name",
"targets": [
["id=Enter user name", "id"],
["name=a2331596497617277", "name"],
["css=#Enter\\ user\\ name", "css:finder"],
["xpath=//input[#id='Enter user name']", "xpath:attributes"],
["xpath=//form[#id='vpnForm']/div[2]/div[2]/input", "xpath:idRelative"],
["xpath=//input", "xpath:position"]
],
"value": "<username>"
}, {
"id": "9d214279-4c2b-4f4f-8d0a-e543b7a2f20c",
"comment": "",
"command": "click",
"target": "id=passwd",
"targets": [
["id=passwd", "id"],
["name=a7843188983724988", "name"],
["css=#passwd", "css:finder"],
["xpath=//input[#id='passwd']", "xpath:attributes"],
["xpath=//form[#id='vpnForm']/div[3]/div[2]/input[2]", "xpath:idRelative"],
["xpath=//div[3]/div[2]/input[2]", "xpath:position"]
],
"value": ""
}, {
"id": "cab3aa5d-3135-407b-9e19-67425a6e8f23",
"comment": "",
"command": "type",
"target": "id=passwd",
"targets": [
["id=passwd", "id"],
["name=a7843188983724988", "name"],
["css=#passwd", "css:finder"],
["xpath=//input[#id='passwd']", "xpath:attributes"],
["xpath=//form[#id='vpnForm']/div[3]/div[2]/input[2]", "xpath:idRelative"],
["xpath=//div[3]/div[2]/input[2]", "xpath:position"]
],
"value": "<password>"
}, {
"id": "548fc696-d596-48b1-9e3d-7fd56c24e316",
"comment": "",
"command": "click",
"target": "id=Log_On",
"targets": [
["id=Log_On", "id"],
["css=#Log_On", "css:finder"],
["xpath=//input[#id='Log_On']", "xpath:attributes"],
["xpath=//form[#id='vpnForm']/div[5]/div[2]/input", "xpath:idRelative"],
["xpath=//div[5]/div[2]/input", "xpath:position"]
],
"value": ""
}, {
"id": "f3097827-cded-437a-ad6b-ad687620b325",
"comment": "",
"command": "storeXpathCount",
"target": "xpath=//button[#id=protocolhandler-welcome-installButton]",
"targets": [],
"value": "detectAppButton"
}, {
"id": "5cbc7df3-3849-4de2-92b4-e62c4e58ece9",
"comment": "",
"command": "echo",
"target": "\"Detect app button count: ${detectAppButton}\"",
"targets": [],
"value": ""
}, {
"id": "8327726c-2c65-48c5-a718-17a02bfda510",
"comment": "",
"command": "if",
"target": "${detectAppButton} != 0",
"targets": [],
"value": ""
}, {
"id": "abf1c098-4cfb-427d-8f8b-6d7857053580",
"comment": "",
"command": "click",
"target": "id=protocolhandler-welcome-installButton",
"targets": [
["id=protocolhandler-welcome-installButton", "id"],
["linkText=Detect Citrix Workspace app", "linkText"],
["css=#protocolhandler-welcome-installButton", "css:finder"],
["xpath=//a[contains(text(),'Detect Citrix Workspace app')]", "xpath:link"],
["xpath=//a[#id='protocolhandler-welcome-installButton']", "xpath:attributes"],
["xpath=//section[#id='protocolhandler-welcome']/div/div/div/div/a", "xpath:idRelative"],
["xpath=(//a[contains(#href, '#')])[75]", "xpath:href"],
["xpath=//section[15]/div/div/div/div/a", "xpath:position"],
["xpath=//a[contains(.,'Detect Citrix Workspace app')]", "xpath:innerText"]
],
"value": ""
}, {
"id": "69099a3c-f063-4e1c-a0b4-c7738fd1b7b7",
"comment": "",
"command": "click",
"target": "id=protocolhandler-detect-alreadyInstalledLink",
"targets": [
["id=protocolhandler-detect-alreadyInstalledLink", "id"],
["linkText=Already installed", "linkText"],
["css=#protocolhandler-detect-alreadyInstalledLink", "css:finder"],
["xpath=//a[contains(text(),'Already installed')]", "xpath:link"],
["xpath=//a[#id='protocolhandler-detect-alreadyInstalledLink']", "xpath:attributes"],
["xpath=//section[#id='protocolhandler-detect']/div/div/div/div/div/a[3]", "xpath:idRelative"],
["xpath=(//a[contains(#href, '#')])[80]", "xpath:href"],
["xpath=//div/div/div/div/a[3]", "xpath:position"],
["xpath=//a[contains(.,'Already installed')]", "xpath:innerText"]
],
"value": ""
}, {
"id": "ca01a29c-c81e-41e7-b5a1-f2353e41f2eb",
"comment": "",
"command": "end",
"target": "",
"targets": [],
"value": ""
}, {
"id": "0e38face-2b4e-4e0b-8d33-f51d1135f66e",
"comment": "",
"command": "waitForElementPresent",
"target": "css=.embedded-settings-icon-svg",
"targets": [],
"value": "30000"
}, {
"id": "40c7f091-d764-4cdc-afbb-dcd33fb63a2b",
"comment": "",
"command": "click",
"target": "css=.embedded-settings-icon-svg",
"targets": [
["css=.embedded-settings-icon-svg", "css:finder"],
["xpath=//a[#id='userMenuBtn']/div", "xpath:idRelative"],
["xpath=//div[3]/div[2]/a/div", "xpath:position"]
],
"value": ""
}, {
"id": "ca625f05-8e4c-4e89-b86c-7a7bc34eb8d0",
"comment": "",
"command": "click",
"target": "id=dropdownLogOffBtn",
"targets": [
["id=dropdownLogOffBtn", "id"],
["linkText=Log off", "linkText"],
["css=#dropdownLogOffBtn", "css:finder"],
["xpath=//a[contains(text(),'Log off')]", "xpath:link"],
["xpath=//a[#id='dropdownLogOffBtn']", "xpath:attributes"],
["xpath=//section[#id='home-screen']/div[2]/header/div[3]/div[2]/div/div[2]/a[3]", "xpath:idRelative"],
["xpath=(//a[contains(#href, '#')])[27]", "xpath:href"],
["xpath=//div[2]/div/div[2]/a[3]", "xpath:position"]
],
"value": ""
}, {
"id": "217d8cec-6440-4640-9abd-c384295220ea",
"comment": "",
"command": "close",
"target": "",
"targets": [],
"value": ""
}]
}],
"suites": [{
"id": "36dd9aa5-f61d-408d-98c8-2773d1e7a4e2",
"name": "Default Suite",
"persistSession": false,
"parallel": false,
"timeout": 300,
"tests": ["b4bc2240-d614-4924-bb6c-a6b6bfec2012"]
}],
"urls": ["https://apps.successwareasp.com/"],
"plugins": []
}
Could you please help me understand if we can have multiple array properties in 1 vertex.. For example,
"id": "CU10611973PH",
"label": "Phone-Home",
"type": "vertex",
"properties": {
"PhonePreference": [
{
"id": "c63cf5c9-329b-456e-b94e-0c500587780f",
"value": "Primary"
}
],
"PhoneType": [
{
"id": "11f241d8-8e84-479b-b6a4-aeab7e039665",
"value": "Home"
}
],
"PhoneNumber": [
{
"id": "5795e2ec-6d8c-424c-b42d-f01b587caeca",
"value": "22222222222"
}
],
"pk": [
{
"id": "CU10611973PH|pk",
"value": "pk"
}
]
}
},
{
"id": "CU10611973PC",
"label": "Phone-cell",
"type": "vertex",
"properties": {
"PhonePreference": [
{
"id": "488c54b2-f256-4053-adc5-c07ec2e1a629",
"value": "Primary"
}
],
"PhoneType": [
{
"id": "2f5263e7-f42b-487f-a185-338682a68fdd",
"value": "Cell"
}
],
"PhoneNumber": [
{
"id": "a967516d-986c-4eac-929a-b86824677922",
"value": "123456789"
}
],
"pk": [
{
"id": "CU10611973PC|pk",
"value": "pk"
So here we are having 2 vertex, one for Phone-Home and one for Phone-Cell. Is there a way to make it come under 1 vertex with 2 set of properties .
I'm working with vega charts (parallel coordinates). How do I change the color of the lines with respect to scheme colors (w.r.t 'name' field).
Here is my code
I tried changing the stroke property with color scale but there is no effect on line stroke.
Can anyone point out what am I doing wrong.
I'm using Vega Version 4
Thanks
vikky
Because the colors need to be by column "name", transform the input dataset to have repeated name rows. In other words, input dataset must be of 3 columns (name, quarter, value)
Then, change "group" type mark to use facet dataset grouped by column "name"
"name": "marks_group_lines",
"type": "group",
"from": {
"facet": {
"name": "cars_by_name",
"data": "cars",
"groupby": "name"
}
},
Use the cars_by_name as dataset to render "line" type mark.
tip: Instead of defining quarter dataset for 4 axes for each qarter and scales for these axes, "line" type mark which has point scale for "x" property can be used.
Full code for reference:
{
"$schema": "https://vega.github.io/schema/vega/v4.json",
"width": 700,
"height": 400,
"padding": 5,
"config": {
"axisY": {
"titleX": -2,
"titleY": 410,
"titleAngle": 0,
"titleAlign": "right",
"titleBaseline": "top"
}
},
"data": [
{
"name": "cars",
"values": [
{
"name": "A",
"quarter": "Q1",
"value": 51
},
{
"name": "A",
"quarter": "Q2",
"value": 47
},
{
"name": "A",
"quarter": "Q3",
"value": 45
},
{
"name": "A",
"quarter": "Q4",
"value": 30
},
{
"name": "B",
"quarter": "Q1",
"value": 42
},
{
"name": "B",
"quarter": "Q2",
"value": 57
},
{
"name": "B",
"quarter": "Q3",
"value": 72
},
{
"name": "B",
"quarter": "Q4",
"value": 41
},
{
"name": "C",
"quarter": "Q1",
"value": 25
},
{
"name": "C",
"quarter": "Q2",
"value": 37
},
{
"name": "C",
"quarter": "Q3",
"value": 60
},
{
"name": "C",
"quarter": "Q4",
"value": 25
},
{
"name": "D",
"quarter": "Q1",
"value": 22
},
{
"name": "D",
"quarter": "Q2",
"value": 25
},
{
"name": "D",
"quarter": "Q3",
"value": 51
},
{
"name": "D",
"quarter": "Q4",
"value": 42
}
]
},
{
"name": "fields",
"values": [
"Q1",
"Q2",
"Q3",
"Q4"
]
}
],
"scales": [
{
"name": "name_to_xaxis",
"type": "point",
"domain": {
"data": "cars",
"field": "quarter"
},
"range": "width"
},
{
"name": "values_to_height",
"type": "linear",
"domain": {
"data": "cars",
"field": "value"
},
"range": "height"
},
{
"name": "quarter_to_color",
"type": "ordinal",
"domain": {
"data": "cars",
"field": "name"
},
"range": "category"
},
{
"name": "ord",
"type": "point",
"range": "width",
"round": true,
"domain": {
"data": "fields",
"field": "data"
}
},
{
"name": "Q1",
"type": "linear",
"range": "height",
"zero": false,
"nice": true,
"domain": {
"data": "cars",
"field": "Q1"
}
},
{
"name": "Q2",
"type": "linear",
"range": "height",
"zero": false,
"nice": true,
"domain": {
"data": "cars",
"field": "Q2"
}
},
{
"name": "Q3",
"type": "linear",
"range": "height",
"zero": false,
"nice": true,
"domain": {
"data": "cars",
"field": "Q3"
}
},
{
"name": "Q4",
"type": "linear",
"range": "height",
"zero": false,
"nice": true,
"domain": {
"data": "cars",
"field": "Q4"
}
}
],
"axes": [
{
"orient": "left",
"zindex": 1,
"scale": "Q1",
"title": "Q1",
"ticks": false,
"labels": false,
"offset": {
"scale": "ord",
"value": "Q1",
"mult": -1
}
},
{
"orient": "left",
"zindex": 1,
"scale": "Q2",
"title": "Q2",
"ticks": false,
"labels": false,
"offset": {
"scale": "ord",
"value": "Q2",
"mult": -1
}
},
{
"orient": "left",
"zindex": 1,
"scale": "Q3",
"title": "Q3",
"ticks": false,
"labels": false,
"offset": {
"scale": "ord",
"value": "Q3",
"mult": -1
}
},
{
"orient": "left",
"zindex": 1,
"scale": "Q4",
"title": "Q4",
"ticks": false,
"labels": false,
"offset": {
"scale": "ord",
"value": "Q4",
"mult": -1
}
}
],
"marks": [
{
"name": "marks_group_lines",
"type": "group",
"from": {
"facet": {
"name": "cars_by_name",
"data": "cars",
"groupby": "name"
}
},
"marks": [
{
"name": "marks_lines",
"type": "line",
"from": {
"data": "cars_by_name"
},
"encode": {
"update": {
"x": {
"scale": "name_to_xaxis",
"field": "quarter"
},
"y": {
"scale": "values_to_height",
"field": "value"
},
"stroke": {
"scale": "quarter_to_color",
"field": "name"
},
"strokeOpacity": {
"value": 1
}
},
"hover": {
"stroke": {
"value": "#7c7c7c"
},
"strokeOpacity": {
"value": 1
},
"zindex": 99
}
}
},
{
"name": "marks_symbols",
"type": "symbol",
"from": {
"data": "cars_by_name"
},
"encode": {
"enter": {
"stroke": {
"value": "#6D6D6D"
},
"strokeWidth": {
"value": 1
},
"shape": {
"value": "circle"
}
},
"update": {
"x": {
"scale": "name_to_xaxis",
"field": "quarter"
},
"y": {
"scale": "values_to_height",
"field": "value"
},
"fill": {
"scale": "quarter_to_color",
"field": "name"
},
"size": {
"value": 50
},
"stroke": {
"value": "#77AE80"
}
},
"hover": {
"fill": {
"value": "#AFD098"
}
}
}
}
]
}
]
}
I was searching the web for a long time. I'm trying to put if and else statements into this selenium IDE. The program itself doesn't provide any parameters, hints, or help. I saw a lot of results online where it's just java code, however I don't see anyway to enter code here.
Can someone show me an example of how to use this if and then statement?
Basic if condition example:
Example .side file. Save the below code in file with name as 'Test.side' and open in selenium ide
{
"id": "92a8cfe0-a7ed-45a4-82c2-59f889cba0a6",
"version": "1.1",
"name": "test",
"url": "",
"tests": [{
"id": "f78b739a-886c-4842-9d61-f83700ef29f6",
"name": "test",
"commands": [{
"id": "ff43b0cf-7207-4599-8f11-3f90102cd1e2",
"comment": "",
"command": "open",
"target": "https://in.yahoo.com",
"targets": [],
"value": ""
}, {
"id": "12efa973-069b-4254-9813-868d4a34876d",
"comment": "",
"command": "storeTitle",
"target": "",
"targets": [],
"value": "title"
}, {
"id": "abde904f-6f3f-4a5a-b24a-59c3b2eafe2c",
"comment": "",
"command": "if",
"target": "${title} != 'Google'",
"targets": [],
"value": ""
}, {
"id": "bb6640f2-6356-439f-b226-287030e8fa5a",
"comment": "",
"command": "open",
"target": "https://www.google.com",
"targets": [],
"value": ""
}, {
"id": "ee3b8144-4981-460d-b707-e925e52ebe41",
"comment": "",
"command": "assertTitle",
"target": "Google",
"targets": [],
"value": ""
}, {
"id": "f73c9836-4944-45aa-be07-9647991ffb36",
"comment": "",
"command": "end",
"target": "",
"targets": [],
"value": ""
}, {
"id": "bcc2bd2b-5091-4b40-b499-f89c38e532bf",
"comment": "",
"command": "sendKeys",
"target": "name=q",
"targets": [],
"value": "Hello world"
}]
}],
"suites": [{
"id": "e966e7ba-8ccd-418a-80e7-f99ac6c25f90",
"name": "Default Suite",
"persistSession": false,
"parallel": false,
"timeout": 300,
"tests": ["f78b739a-886c-4842-9d61-f83700ef29f6"]
}],
"urls": [],
"plugins": []
}
If with else Example
Example .side file.
{
"id": "92a8cfe0-a7ed-45a4-82c2-59f889cba0a6",
"version": "1.1",
"name": "test",
"url": "",
"tests": [{
"id": "f78b739a-886c-4842-9d61-f83700ef29f6",
"name": "test",
"commands": [{
"id": "ff43b0cf-7207-4599-8f11-3f90102cd1e2",
"comment": "",
"command": "open",
"target": "https://www.google.com",
"targets": [],
"value": ""
}, {
"id": "12efa973-069b-4254-9813-868d4a34876d",
"comment": "",
"command": "storeTitle",
"target": "",
"targets": [],
"value": "title"
}, {
"id": "abde904f-6f3f-4a5a-b24a-59c3b2eafe2c",
"comment": "",
"command": "if",
"target": "${title} == 'Google'",
"targets": [],
"value": ""
}, {
"id": "bb6640f2-6356-439f-b226-287030e8fa5a",
"comment": "",
"command": "echo",
"target": "I am in Yahoo Page",
"targets": [],
"value": ""
}, {
"id": "ee3b8144-4981-460d-b707-e925e52ebe41",
"comment": "",
"command": "assertTitle",
"target": "Google",
"targets": [],
"value": ""
}, {
"id": "f73c9836-4944-45aa-be07-9647991ffb36",
"comment": "",
"command": "else",
"target": "",
"targets": [],
"value": ""
}, {
"id": "a90e7c75-911a-46cb-ac52-a3fd394e6dfe",
"comment": "",
"command": "echo",
"target": "I am in already in google Page",
"targets": [],
"value": ""
}, {
"id": "2b29d6fe-a670-4349-be18-794e85fbd498",
"comment": "",
"command": "end",
"target": "",
"targets": [],
"value": ""
}, {
"id": "7f8ee438-4dae-4f34-b4b6-7a4a166acabf",
"comment": "",
"command": "sendKeys",
"target": "q=name",
"targets": [],
"value": ""
}]
}],
"suites": [{
"id": "e966e7ba-8ccd-418a-80e7-f99ac6c25f90",
"name": "Default Suite",
"persistSession": false,
"parallel": false,
"timeout": 300,
"tests": ["f78b739a-886c-4842-9d61-f83700ef29f6"]
}],
"urls": [],
"plugins": []
}
If with ElseIf Example
Example selenium ide test file (.side)
{
"id": "92a8cfe0-a7ed-45a4-82c2-59f889cba0a6",
"version": "1.1",
"name": "test",
"url": "",
"tests": [{
"id": "f78b739a-886c-4842-9d61-f83700ef29f6",
"name": "test",
"commands": [{
"id": "ff43b0cf-7207-4599-8f11-3f90102cd1e2",
"comment": "",
"command": "open",
"target": "https://www.google.com",
"targets": [],
"value": ""
}, {
"id": "12efa973-069b-4254-9813-868d4a34876d",
"comment": "",
"command": "storeTitle",
"target": "",
"targets": [],
"value": "title"
}, {
"id": "abde904f-6f3f-4a5a-b24a-59c3b2eafe2c",
"comment": "",
"command": "if",
"target": "${title} == 'Google'",
"targets": [],
"value": ""
}, {
"id": "bb6640f2-6356-439f-b226-287030e8fa5a",
"comment": "",
"command": "echo",
"target": "I am in Yahoo Page",
"targets": [],
"value": ""
}, {
"id": "ee3b8144-4981-460d-b707-e925e52ebe41",
"comment": "",
"command": "assertTitle",
"target": "Google",
"targets": [],
"value": ""
}, {
"id": "f73c9836-4944-45aa-be07-9647991ffb36",
"comment": "",
"command": "elseIf",
"target": "${title} != 'Yahoo'",
"targets": [],
"value": ""
}, {
"id": "a90e7c75-911a-46cb-ac52-a3fd394e6dfe",
"comment": "",
"command": "echo",
"target": "I am in google Page",
"targets": [],
"value": ""
}, {
"id": "2b29d6fe-a670-4349-be18-794e85fbd498",
"comment": "",
"command": "end",
"target": "",
"targets": [],
"value": ""
}, {
"id": "bcc2bd2b-5091-4b40-b499-f89c38e532bf",
"comment": "",
"command": "echo",
"target": "I am out side the if condition",
"targets": [],
"value": ""
}]
}],
"suites": [{
"id": "e966e7ba-8ccd-418a-80e7-f99ac6c25f90",
"name": "Default Suite",
"persistSession": false,
"parallel": false,
"timeout": 300,
"tests": ["f78b739a-886c-4842-9d61-f83700ef29f6"]
}],
"urls": [],
"plugins": []
}
As this question is for the "big" Visual Studio and Resharper, I'd like to see that feature in VS Code too.
Scrolling through the shortcut list for VS Code, I couldn't find it but I'm hoping that it's still there but called something less intuitive than camel, hump or such.
As of version 1.25 these commands are built in:
I found this extensions to work https://marketplace.visualstudio.com/items?itemName=ow.vscode-subword-navigation
Funny thing is that you need to configure each combination separately:
{
"key": "alt+left",
"command": "subwordNavigation.cursorSubwordLeft",
"when": "editorTextFocus"
},
{
"key": "alt+right",
"command": "subwordNavigation.cursorSubwordRight",
"when": "editorTextFocus"
},
{
"key": "alt+shift+left",
"command": "subwordNavigation.cursorSubwordLeftSelect",
"when": "editorTextFocus"
},
{
"key": "alt+shift+right",
"command": "subwordNavigation.cursorSubwordRightSelect",
"when": "editorTextFocus"
},
{
"key": "alt+backspace",
"command": "subwordNavigation.deleteSubwordLeft",
"when": "editorTextFocus"
},
{
"key": "alt+delete",
"command": "subwordNavigation.deleteSubwordRight",
"when": "editorTextFocus"
}
If for some reasons your bindings are not set here is the json to obtain Cezn's shortcuts.
{
"key": "ctrl+alt+right",
"command": "cursorWordPartRight",
"when": "editorTextFocus"
},
{
"key": "ctrl+alt+shift+right",
"command": "cursorWordPartRightSelection",
"when": "editorTextFocus"
},
{
"key": "ctrl+alt+left",
"command": "cursorWordPartLeft",
"when": "editorTextFocus"
},
{
"key": "ctrl+alt+shift+left",
"command": "cursorWordPartLeftSelection",
"when": "editorTextFocus"
}
{
"key": "ctrl+alt+backspace",
"command": "deleteWordPartLeft",
"when": "editorTextFocus && !editorReadonly"
},
{
"key": "ctrl+alt+delete",
"command": "deleteWordPartRight",
"when": "editorTextFocus && !editorReadonly"
}
Be careful with the ctrl+alt+delete one since it conflicts with another popular windows shortcut.
Other interesting bindings are:
{
"key": "ctrl+n",
"command": "explorer.newFile",
"when": "explorerViewletFocus"
},
{
"key": "ctrl+shift+n",
"command": "explorer.newFolder",
"when": "explorerViewletFocus"
}
There is an extension for this: Camel Case Navigation