right click on application in system tray using winapp driver

451 views
Skip to first unread message

Rahul

unread,
Apr 7, 2019, 11:16:51 PM4/7/19
to Selenium Users
Hello All,

I am trying to automate a right click on a operation on a icon in windows system tray but having difficulties in doing so.
I found one implementation in one of the winappdriver forum but getting error in. below is my following code snippet

require 'selenium-webdriver'


def caps 
    {
        platformName: "WINDOWS", platform: "WINDOWS", deviceName: "mydevice", app: "Root"
    }
end



driver = Selenium::WebDriver.for(:remote, :url => "http://127.0.0.1:4723/", :desired_capabilities => caps )

driver.find_element(:name, 'Notification Chevron').click
sleep(5)
element = driver.find_element(:name, 'Avast')[0]
driver.action.context_click(element).perform()

and the error I get is 
NoMethodError: undefined method []' for nil:NilClass
   C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/selenium-webdriver-3.5.2/lib/selenium/webdriver/common/action_builder.rb:357:inperform'

Any help on this is appreciated

Thank you

Joe Ward

unread,
Apr 8, 2019, 1:57:51 AM4/8/19
to seleniu...@googlegroups.com
It doesn’t know what [0] is. Typically I think you’d use this when there are multiple elements, so maybe there aren’t. 

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/19160ed5-be80-4770-88ff-fbd7f93a001e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mark Collin

unread,
Apr 8, 2019, 4:39:22 AM4/8/19
to Selenium Users
WebDriver is used to drive a browser, it's not aware of the system tray.

It looks like you are trying to use WinAppDriver functionality with base selenium libraries, this will not work for you.

Reply all
Reply to author
Forward
0 new messages