I am new to appium, Wrote sample program to open app and click event for icon
Test case is passed -> Splash screen is opened , but event is not fired.Sometime its working and most of the time it wont
Code Snippet:
WebElement phoneSignIn = new WebDriverWait(driver, 10).until(ExpectedConditions
.refreshed(ExpectedConditions.presenceOfElementLocated(By.id("com.xyz.xyz:id/primaryGoogleLoginButton"))));
Assert.assertTrue(phoneSignIn != null && phoneSignIn.isDisplayed(), "Phone SignIn Button is not displayed");
phoneSignIn.click();
Appium server log:
[HTTP] --> POST /wd/hub/session/388a407b-99f5-4eaf-8c9b-d6d948bb8851/element
[HTTP] {"using":"id","value":"com.xyz.xyz:id/primaryGoogleLoginButton"}
[debug] [W3C (388a407b)] Calling AppiumDriver.findElement() with args: ["id","com.xyz.xyz:id/primaryGoogleLoginButton","388a407b-99f5-4eaf-8c9b-d6d948bb8851"]
[debug] [BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, css selector, -android uiautomator
[debug] [BaseDriver] Waiting up to 0 ms for condition
[debug] [WD Proxy] Matched '/element' to command name 'findElement'
[debug] [WD Proxy] Proxying [POST /element] to [POST http://127.0.0.1:8200/wd/hub/session/6067d30e-befe-4413-86c9-ed95af200bc1/element] with body: {"strategy":"id","selector":"com.xyz.xyz:id/primaryGoogleLoginButton","context":"","multiple":false}
[debug] [WD Proxy] Got response with status 200: {"sessionId":"6067d30e-befe-4413-86c9-ed95af200bc1","value":{"ELEMENT":"6038c598-1fce-4613-80f2-30546c9a9510","element-6066-11e4-a52e-4f735466cecf":"6038c598-1fce-4613-80f2-30546c9a9510"}}
[debug] [W3C (388a407b)] Responding to client with driver.findElement() result: {"element-6066-11e4-a52e-4f735466cecf":"6038c598-1fce-4613-80f2-30546c9a9510","ELEMENT":"6038c598-1fce-4613-80f2-30546c9a9510"}
[HTTP] <-- POST /wd/hub/session/388a407b-99f5-4eaf-8c9b-d6d948bb8851/element 200 628 ms - 137
[HTTP]
[HTTP] --> GET /wd/hub/session/388a407b-99f5-4eaf-8c9b-d6d948bb8851/element/6038c598-1fce-4613-80f2-30546c9a9510/displayed
[HTTP] {}
[debug] [W3C (388a407b)] Calling AppiumDriver.elementDisplayed() with args: ["6038c598-1fce-4613-80f2-30546c9a9510","388a407b-99f5-4eaf-8c9b-d6d948bb8851"]
[debug] [WD Proxy] Matched '/element/6038c598-1fce-4613-80f2-30546c9a9510/attribute/displayed' to command name 'getAttribute'
[debug] [WD Proxy] Proxying [GET /element/6038c598-1fce-4613-80f2-30546c9a9510/attribute/displayed] to [GET http://127.0.0.1:8200/wd/hub/session/6067d30e-befe-4413-86c9-ed95af200bc1/element/6038c598-1fce-4613-80f2-30546c9a9510/attribute/displayed] with no body
[debug] [WD Proxy] Got response with status 200: {"sessionId":"6067d30e-befe-4413-86c9-ed95af200bc1","value":"true"}
[debug] [W3C (388a407b)] Responding to client with driver.elementDisplayed() result: true
[HTTP] <-- GET /wd/hub/session/388a407b-99f5-4eaf-8c9b-d6d948bb8851/element/6038c598-1fce-4613-80f2-30546c9a9510/displayed 200 17 ms - 14
[HTTP]
[HTTP] --> POST /wd/hub/session/388a407b-99f5-4eaf-8c9b-d6d948bb8851/element/6038c598-1fce-4613-80f2-30546c9a9510/click
[HTTP] {"id":"6038c598-1fce-4613-80f2-30546c9a9510"}
[debug] [W3C (388a407b)] Calling AppiumDriver.click() with args: ["6038c598-1fce-4613-80f2-30546c9a9510","388a407b-99f5-4eaf-8c9b-d6d948bb8851"]
[debug] [WD Proxy] Matched '/element/6038c598-1fce-4613-80f2-30546c9a9510/click' to command name 'click'
[debug] [WD Proxy] Proxying [POST /element/6038c598-1fce-4613-80f2-30546c9a9510/click] to [POST http://127.0.0.1:8200/wd/hub/session/6067d30e-befe-4413-86c9-ed95af200bc1/element/6038c598-1fce-4613-80f2-30546c9a9510/click] with body: {"element":"6038c598-1fce-4613-80f2-30546c9a9510"}
[debug] [WD Proxy] Got response with status 200: {"sessionId":"6067d30e-befe-4413-86c9-ed95af200bc1","value":null}
[debug] [W3C (388a407b)] Responding to client with driver.click() result: null
[HTTP] <-- POST /wd/hub/session/388a407b-99f5-4eaf-8c9b-d6d948bb8851/element/6038c598-1fce-4613-80f2-30546c9a9510/click 200 646 ms - 14
[HTTP]
Any help appreciated!
REST API details from documentation:
GET /REST/sql_snapshot/2003-03-01.sql.gz HTTP/1.1
Host: some.api.net
Authorization: Basic qpow3i12o3
The response shown below omits the message body, which contains binary compressed SQL data.
HTTP/1.1 200 OK
Date: Wed, 05 Mar 2003 10:19:46 GMT
Server: Apache/1.3.22 (Unix) (Red-Hat/Linux)Content-Type: application/octet-stream
I'm getting a response code of -1 from below.
URL url = new URL("https://some.api.net/REST/sql_snapshot/2003-03-01.sql.gz");
HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connection.setRequestProperty("Content-Type", "application/octet-stream");
connection.setDoOutput(true);
connection.connect();
Hello I'm making an app which use http framework and send my server to get request. I'm using Aqueduct for backend service and it is working when I use POSTMAN to send 'get request' but when I use my app to send get request Aqueduct gives a message on console:
[INFO] aqueduct: OPTIONS /workers 8ms 403 {user-agent : Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/IP_ADRESS Safari/537.36\nconnection : keep-alive\naccept : */*\naccept-language : en-US,en;q=0.9\nsec-fetch-mode : cors\naccept-encoding : gzip, deflate, br\norigin : http://localhost:58095\nhost : localhost:8888\nsec-fetch-site : same-site\naccess-control-request-headers : authorization,companymail,content-type\naccess-control-request-method : GET\nreferer : http://localhost:58095/\n}
When I use postman to send get request everything is fine and server gives response:
[INFO] aqueduct: GET /workers 92ms 200
My Postman Headers:
companyMail:deneme1234
Content-Type:application/json
Authorization:Basic ZGVuZW1lMTIzNDpkZW5lbWUxMjM0
My flutter app headers:
final Map<String, String> headers = {"Content-Type": "application/json"};
String basicAuth = 'Basic ' + base64Encode(utf8.encode('$mail:$password'));
headers['authorization'] = basicAuth;
headers['companyMail'] = companyMail;
return headers
My flutter app get request:
final response = http.get(baseUrl+'workers',headers: await authHeader());
Finally I've found the solution :) It is about CorsPolicy. If you want to send special header with request, you must check your server acceptable headers. In Aqueduct you can edit your allowed request headers like that:
CORSPolicy.defaultPolicy.allowedRequestHeaders = ['company-mail','content-type','authorization'];
I need to update firmware of my chromecast but I have restriction on my internet and then I cannot update it automatically. I need to update it by pc while I am using vpn. Therefore, I am using following script in powershell. However, the code run successfully but there is no result.
Invoke-WebRequest -Method Post -ContentType "application/json" -Body '{"params": "ota foreground"}' -
Uri "http://<my chrom IP>:8008/setup/reboot" -Verbose -UserAgent "curl"
Here is result of running that script:
VERBOSE: POST http://<my chrom IP>:8008/setup/reboot with -1-byte payload
VERBOSE: received 0-byte response of content type
StatusCode : 200
StatusDescription : OK
Content : {}
RawContent : HTTP/1.1 200 OK
Access-Control-Allow-Headers: Content-Type
Content-Length: 0
Cache-Control: no-cache
Headers : {[Access-Control-Allow-Headers, Content-Type], [Content-Length, 0], [Cache-Control, no-cache]}
RawContentLength : 0
UPDATE: The problem seems now to have been corrected in the "global" Orion instance.
I try to change an attribute of an entity but it does not seem to have the
wanted effect. The same code worked well 2 months ago, as I recall. What to do with it now?
I have the entity cie_test_1 with the float attribute test_1 in the "global" Orion Broker http://orion.lab.fi-ware.org:1026. I understand that the intention of the broker is to propagate changing values. However, it seems that the value cannot be changed. Details of the transactions are below.
Version information of the broker is
{
"orion" : {
"version" : "0.19.0",
"uptime" : "0 d, 0 h, 2 m, 31 s",
"git_hash" : "1ad73b298cd261861203fbffb9c789f6ade2796d",
"compile_time" : "Wed Feb 11 13:00:19 CET 2015",
"compiled_by" : "fermin",
"compiled_in" : "centollo"
}
}
Transmit value request
Request
POST http://orion.lab.fi-ware.org:1026/ngsi10/contextEntities/cie_test_1/attributes/test_1
Host: orion.lab.fi-ware.org:1026
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:35.0) Gecko/20100101 Firefox/35.0
Accept: application/json
Accept-Language: en-us,en;q=0.7,fi;q=0.3
Accept-Encoding: gzip, deflate
DNT: 0
Content-Type: application/json; charset=UTF-8
X-Auth-Token: <my auth token>
Content-Length: 14
Origin: null
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache
Payload:
{"value":"50"}
NOTE: Attempted to set value = 50
Response from the Orion
Access-Control-Allow-Headers: origin, content-type, X-Auth-Token, Tenant-ID
Access-Control-Allow-Methods: HEAD, POST, GET, OPTIONS, DELETE
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 61
Content-Type: application/json
Date: Fri, 13 Feb 2015 07:52:29 GMT
X-Powered-By: Express
Payload:
"statusCode" : {
"code" : "200",
"reasonPhrase" : "OK"
}
Firefox browser didn't like the response:
SyntaxError: JSON.parse: unexpected non-whitespace character after
JSON data at line 1 column 14 of the JSON data
Better JSON response might be:
{
"statusCode" : {
"code" : "200",
"reasonPhrase" : "OK"
}
}
Value query from the Orion
Query
GET http://orion.lab.fi-ware.org:1026/ngsi10/contextEntities/cie_test_1
Host: orion.lab.fi-ware.org:1026
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:35.0) Gecko/20100101 Firefox/35.0
Accept: application/json
Accept-Language: en-us,en;q=0.7,fi;q=0.3
Accept-Encoding: gzip, deflate
DNT: 0
Content-Type: application/json
X-Auth-Token: <my auth token>
Origin: null
Connection: keep-alive
Response from the Orion
Access-Control-Allow-Headers: origin, content-type, X-Auth-Token, Tenant-ID
Access-Control-Allow-Methods: HEAD, POST, GET, OPTIONS, DELETE
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 289
Content-Type: application/json
Date: Fri, 13 Feb 2015 10:09:27 GMT
X-Powered-By: Express
Payload:
{
"Success: {
"contextElement" : {
"type" : "",
"isPattern" : "false",
"id" : "cie_test_1",
"attributes" : [
{
"name" : "test_1",
"type" : "float",
"value" : "10"
}
]
},
"statusCode" : {
"code" : "200",
"reasonPhrase" : "OK"
}
}
}
NOTE: value is still 10
This problem is related with service path functionality and, in particular, with the the following fix introduced in 0.19.0 version:
Fix: internal substitution of servicePath defaults ("/" for
update-like operations, "/#" for query-like operations)
Let's consider the following situation: an entity document exists in the DB but it was generated using an Orion version previous to 0.19.0, thus without servicePath field, i.e:
id = E1
type = T1
servicePath = [null]
attr.test_1 = 10
Now, Orion 0.19.0 processes an updateContext APPEND on [E1, T1] (note the POST in your question has APPEND semantics). That doesn't result in updating the previous entity document, but in creating a new entity document:
id = E1
type = T1
servicePath = "/"
attr.test_1 = 50
Thus, now we have 2 documents in entities collection in the DB, almost equal but not exactly equal. In fact, if you use queryContext on [E1, T1] with service path "/" or without servicePath (wich implicitely mean "service path is not relevant for the query") you will get both in the response, one with 10 and other with 50 fo the test_1 attribute.
However, convenience operations based on GET doesn't work the same as queryContext (at least in the current Orion version). Convenience GET assumes that only one document is going to be put into the response and in this ambiguous case it takes the older one (i.e. the one which modification date annotated in the DB is older). In other words, the one with test_1 value to 10.
The solution to this is to fix the database in order to "merge" the 2 entities document into one (with servicePath = "/"). For orion.lab.fi-ware.org (the case in your question), the FIWARE Lab staff will do that in the comming days. For private Orion instances, the merge_default_sp_dups.py script is provided to do it (check database migration procedure for 0.19.0 for more information).
UPDATE: orion.lab.fi-ware.org DB has been fixed. You shouldn't have the updating problem described in your question any longer.