aerokube / selenoid

Selenium Hub successor running browsers within containers. Scalable, immutable, self hosted Selenium-Grid on any platform with single binary.
https://aerokube.com/selenoid/latest/
Apache License 2.0
2.59k stars 322 forks source link

Unable to find element on selenoid/firefox while the element can be found on selenoid/chrome #890

Closed fedika closed 7 months ago

fedika commented 4 years ago

Dear selenoid,

Thank you for provide selenoid as test environments, I'm really appreciate it. So far we use selenoid, selenoid_ui and selenoid/vnc_chrome and there is no problem with them when we run the tests. But when we try to run our tests on selenoid/vnc_firefox, the browser opened up, page displayed but all of elements cannot be found, whild we do not face this problem on selenoid/vnc_chrome.

The spec : selenoid v1.10.0 selenoid_ui v1.10.0 selenoid/vnc_firefox:70.0

I tried to run our tests on webdriver local firefox version 74 and it works.

Thank you

vania-pooh commented 4 years ago

@fedika Selenoid just does reverse proxying to geckodriver inside Docker image. So just the same issue should reproduce locally with Firefox 74.0 and latest Geckodriver release if you go there directly: run Geckodriver manually as a binary and then go to http://localhost:4444/ as Selenium URL.

fedika commented 4 years ago

hi @vania-pooh ,

Thanks for response, but I did not find same issue when run locally use geckodriver v1.19.1 and Firefox 74.0, the element can be found.

Here is the log from selenoid:

1585817086201   Marionette  DEBUG   0 -> [0,47,"WebDriver:FindElements",{"using":"xpath","value":"//img[@class='ts-link-header-logo']"}]
1585817086204   Marionette  DEBUG   0 <- [1,47,null,[{"element-6066-11e4-a52e-4f735466cecf":"c0e993f6-d580-4508-b40c-fb41c0de7056"}]]
1585817086205   webdriver::server   DEBUG   <- 200 OK {"value":[{"element-6066-11e4-a52e-4f735466cecf":"c0e993f6-d580-4508-b40c-fb41c0de7056"}]}
1585817086708   webdriver::server   DEBUG   -> POST /session/f20a123d-2356-4cf3-953d-d073db0e63b8/elements {"using":"xpath","value":"//img[@class='ts-link-header-logo']"}
1585817086709   Marionette  DEBUG   0 -> [0,48,"WebDriver:FindElements",{"using":"xpath","value":"//img[@class='ts-link-header-logo']"}]
1585817086712   Marionette  DEBUG   0 <- [1,48,null,[{"element-6066-11e4-a52e-4f735466cecf":"c0e993f6-d580-4508-b40c-fb41c0de7056"}]]
1585817086713   webdriver::server   DEBUG   <- 200 OK {"value":[{"element-6066-11e4-a52e-4f735466cecf":"c0e993f6-d580-4508-b40c-fb41c0de7056"}]}
1585817087217   webdriver::server   DEBUG   -> POST /session/f20a123d-2356-4cf3-953d-d073db0e63b8/elements {"using":"xpath","value":"//img[@class='ts-link-header-logo']"}
1585817087218   Marionette  DEBUG   0 -> [0,49,"WebDriver:FindElements",{"using":"xpath","value":"//img[@class='ts-link-header-logo']"}]
1585817087221   Marionette  DEBUG   0 <- [1,49,null,[{"element-6066-11e4-a52e-4f735466cecf":"c0e993f6-d580-4508-b40c-fb41c0de7056"}]]
1585817087222   webdriver::server   DEBUG   <- 200 OK {"value":[{"element-6066-11e4-a52e-4f735466cecf":"c0e993f6-d580-4508-b40c-fb41c0de7056"}]}
1585817087725   webdriver::server   DEBUG   -> POST /session/f20a123d-2356-4cf3-953d-d073db0e63b8/elements {"using":"xpath","value":"//img[@class='ts-link-header-logo']"}
1585817087726   Marionette  DEBUG   0 -> [0,50,"WebDriver:FindElements",{"using":"xpath","value":"//img[@class='ts-link-header-logo']"}]
1585817087729   Marionette  DEBUG   0 <- [1,50,null,[{"element-6066-11e4-a52e-4f735466cecf":"c0e993f6-d580-4508-b40c-fb41c0de7056"}]]
1585817087730   webdriver::server   DEBUG   <- 200 OK {"value":[{"element-6066-11e4-a52e-4f735466cecf":"c0e993f6-d580-4508-b40c-fb41c0de7056"}]}
1585817088233   webdriver::server   DEBUG   -> POST /session/f20a123d-2356-4cf3-953d-d073db0e63b8/elements {"using":"xpath","value":"//img[@class='ts-link-header-logo']"}
1585817088234   Marionette  DEBUG   0 -> [0,51,"WebDriver:FindElements",{"using":"xpath","value":"//img[@class='ts-link-header-logo']"}]
1585817088237   Marionette  DEBUG   0 <- [1,51,null,[{"element-6066-11e4-a52e-4f735466cecf":"c0e993f6-d580-4508-b40c-fb41c0de7056"}]]
1585817088237   webdriver::server   DEBUG   <- 200 OK {"value":[{"element-6066-11e4-a52e-4f735466cecf":"c0e993f6-d580-4508-b40c-fb41c0de7056"}]}

based on the log above, why did the server keep call until 1,51?

this is the log that I got from selenium-debug.log locally use geckodriver and firefox https://codeshare.io/5wLLrj

vania-pooh commented 4 years ago

@fedika we are using Geckodriver 0.26.0 in latest Firefox images.

grasspine commented 4 years ago

Hello @vania-pooh and selenoid team, thank you so much all your work.

I'm currently having the same issue as Fedika. I'm using selenoid with nightwatchjs. The test is running smoothly on selenoid/chrome but the same test is failing on selenoid/firefox because the 'element could not be located' error. Running the test locally with geckodriver did not result in error, so it seems the issue is not with nightwatch (which they apparently fix already https://github.com/nightwatchjs/nightwatch/issues/1628).

I've a sample here https://github.com/grasspine/selenoid-nightwatch-test

vania-pooh commented 4 years ago

@fedika @grasspine could you try to open tested page in Selenoid UI and make sure that the element you are trying to find actually appears? Couldn't this element be platform-specific (Selenoid is running browsers in Linux Docker containers)?

grasspine commented 4 years ago

@vania-pooh yes, the element appears in Selenoid UI and it doesn't seem to be a platform specific element since it's a search bar in duckduckgo page.

Next I tried finding 'body' and it resulted in the same error.

Response 200 POST /wd/hub/session/e56a1da8-25bd-4e47-b3f4-1f50ad6f051f/elements (22ms)
   {
     value: [
       {
         'element-6066-11e4-a52e-4f735466cecf': '3c66e9f7-9f12-4219-afb4-75bf7d61c09f'
       }
     ]
}

Updated the sample.

farcyn commented 4 years ago

Hai @vania-pooh and selenoid teams. Thanks for your hard work Currently I have same problems as @fedika and @grasspine . I tried using selenoid in Chrome and Firefox. When I running in Chrome everything is good but when I tried in Firefox there's error, element is not found. I've tried using several version of selenoid/firefox from latest to selenoid/firefox:66.0, but the error still same.

I used Ubuntu 18.04.4 LTS, Docker 19.03.8, Nightwatch 1.3.4 and Nightwatch-api 3.0.1. This error that I've received:

1594632948937   Marionette  DEBUG   0 -> [0,24,"WebDriver:FindElements",{"using":"xpath","value":"//*[text() = 'Forgot password?']"}]
1594632948946   Marionette  DEBUG   0 <- [1,24,null,[{"element-6066-11e4-a52e-4f735466cecf":"d3400eaf-b91b-4456-8200-c6bb68c97c45"}]]
1594632948947   webdriver::server   DEBUG   <- 200 OK {"value":[{"element-6066-11e4-a52e-4f735466cecf":"d3400eaf-b91b-4456-8200-c6bb68c97c45"}]}
1594632949452   webdriver::server   DEBUG   -> POST /session/3bfdea57-6e95-4f18-bb20-89dd1739378e/elements {"using":"xpath","value":"//*[text() = 'Forgot password?']"}
1594632949453   Marionette  DEBUG   0 -> [0,25,"WebDriver:FindElements",{"using":"xpath","value":"//*[text() = 'Forgot password?']"}]
1594632949459   Marionette  DEBUG   0 <- [1,25,null,[{"element-6066-11e4-a52e-4f735466cecf":"d3400eaf-b91b-4456-8200-c6bb68c97c45"}]]
1594632949460   webdriver::server   DEBUG   <- 200 OK {"value":[{"element-6066-11e4-a52e-4f735466cecf":"d3400eaf-b91b-4456-8200-c6bb68c97c45"}]}
1594632949967   webdriver::server   DEBUG   -> POST /session/3bfdea57-6e95-4f18-bb20-89dd1739378e/elements {"using":"xpath","value":"//*[text() = 'Forgot password?']"}
1594632949968   Marionette  DEBUG   0 -> [0,26,"WebDriver:FindElements",{"using":"xpath","value":"//*[text() = 'Forgot password?']"}]
1594632949972   Marionette  DEBUG   0 <- [1,26,null,[{"element-6066-11e4-a52e-4f735466cecf":"d3400eaf-b91b-4456-8200-c6bb68c97c45"}]]
1594632949973   webdriver::server   DEBUG   <- 200 OK {"value":[{"element-6066-11e4-a52e-4f735466cecf":"d3400eaf-b91b-4456-8200-c6bb68c97c45"}]}
1594632950476   webdriver::server   DEBUG   -> POST /session/3bfdea57-6e95-4f18-bb20-89dd1739378e/elements {"using":"xpath","value":"//*[text() = 'Forgot password?']"}
1594632950477   Marionette  DEBUG   0 -> [0,27,"WebDriver:FindElements",{"using":"xpath","value":"//*[text() = 'Forgot password?']"}]
1594632950483   Marionette  DEBUG   0 <- [1,27,null,[{"element-6066-11e4-a52e-4f735466cecf":"d3400eaf-b91b-4456-8200-c6bb68c97c45"}]]
1594632950484   webdriver::server   DEBUG   <- 200 OK {"value":[{"element-6066-11e4-a52e-4f735466cecf":"d3400eaf-b91b-4456-8200-c6bb68c97c45"}]}
1594632950988   webdriver::server   DEBUG   -> POST /session/3bfdea57-6e95-4f18-bb20-89dd1739378e/elements {"using":"xpath","value":"//*[text() = 'Forgot password?']"}
1594632950989   Marionette  DEBUG   0 -> [0,28,"WebDriver:FindElements",{"using":"xpath","value":"//*[text() = 'Forgot password?']"}]
1594632950992   Marionette  DEBUG   0 <- [1,28,null,[{"element-6066-11e4-a52e-4f735466cecf":"d3400eaf-b91b-4456-8200-c6bb68c97c45"}]]

Can you look into it? Thank you

vania-pooh commented 4 years ago

@farcyn what you are showing is a normal Geckodriver log. Could you share an exact error message you are getting?

farcyn commented 4 years ago

picture1

@vania-pooh this error that I've received after I acces https://mobile.twitter.com/login and tried click the forgot password button

vania-pooh commented 4 years ago

@farcyn according to the log Geckodriver successfully returns found element ID.

grasspine commented 4 years ago

it returns the same result when running locally but here it's working fine.

 → Running command: assert.visible ('body')

 → Running command: isVisible ('body', [Function])
   Request POST  /session/dc85479e-7d76-42a0-9d8b-8cbb67ba7f20/elements  
   { using: 'css selector', value: 'body' }
   Response 200 POST /session/dc85479e-7d76-42a0-9d8b-8cbb67ba7f20/elements (8ms)
   {
     value: [
       {
         'element-6066-11e4-a52e-4f735466cecf': '127f535e-854f-4ce4-affe-bbf0c9cc4bda'
       }
     ]
}
   Request GET  /session/dc85479e-7d76-42a0-9d8b-8cbb67ba7f20/element/127f535e-854f-4ce4-affe-bbf0c9cc4bda/displayed  
   Response 200 GET /session/dc85479e-7d76-42a0-9d8b-8cbb67ba7f20/element/127f535e-854f-4ce4-affe-bbf0c9cc4bda/displayed (9ms)
   { value: true }
√ Testing if element <body> is visible (21ms)
  → Completed command: assert.visible ('body') (22ms)
  → Completed command: isVisible ('body', [Function]) (21ms)
grasspine commented 4 years ago

with selenoid

   Request POST  /wd/hub/session/8567d704-95e1-446f-a1a3-b1464c3a60fd/elements  
   { using: 'css selector', value: 'body' }
   Response 200 POST /wd/hub/session/8567d704-95e1-446f-a1a3-b1464c3a60fd/elements (18ms)
   {
     value: [
       {
         'element-6066-11e4-a52e-4f735466cecf': 'd22baad2-df52-4d49-b142-501d694ca6f5'
       }
     ]
}
Timed out while waiting for element <body> to be present for 5000 milliseconds. - expected "found" but got: "not found" (5264ms)
undefined  → Completed command: waitForElementPresent ('body') (5270ms)

full log: https://codeshare.io/5OyWbg

cjgratacos commented 2 years ago

Any updates on this? Our team is facing the same issue.

vania-pooh commented 2 years ago

@cjgratacos what I'm trying to say for 2 years already, this is not a Selenoid bug. Selenoid just proxies everything to Geckodriver.

github-actions[bot] commented 8 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.