Replies: 6 comments
-
An example of self.open("https://seleniumbase.io/demo_page")
self.js_click("#dropOption2") The button was hidden under a dropdown menu unless hovered over, but the For hidden text fields, you can use self.set_value(selector, text) |
Beta Was this translation helpful? Give feedback.
-
Thank you for your quick reply, amazing..
Except… it still doesn’t work, here’s my code of which none work… , following the self.open syntax (which works):
self.js_click("sitelogin:loginForm:username")
self.set_value("sitelogin:loginForm:username","TESTING")
self.set_value("#sitelogin:loginForm:username","TESTING#")
self.set_value('sitelogin:loginForm:username', 'TESTING ')
.. am not sure whether I need to add the # sign or not… .. do I need to perhaps first import JS..?? 😳
Thanks a million
From: Michael Mintz ***@***.***>
Reply to: seleniumbase/SeleniumBase ***@***.***>
Date: Tuesday, 12 September 2023 at 1:56 PM
To: seleniumbase/SeleniumBase ***@***.***>
Cc: ***@***.***" ***@***.***>, Author ***@***.***>
Subject: Re: [seleniumbase/SeleniumBase] How to apply js_click when elements are hidden (Discussion #2095)
An example of js_click would be:
self.open("https://seleniumbase.io/demo_page")
self.js_click("#dropOption2")
The button was hidden under a dropdown menu unless hovered over, but the js_click let you click it directly.
For hidden text fields, you can use set_value(selector, text). Eg:
self.set_value(selector, text)
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
You could try using the SeleniumBase Recorder to generate your scripts for you: https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/recorder_mode.md |
Beta Was this translation helpful? Give feedback.
-
Did that… and got this… which doesn’t work either when I run the new_recording.py:
from seleniumbase import BaseCase
BaseCase.main(__name__, __file__)
class RecorderTest(BaseCase):
def test_recording(self):
self.open("https://xxxxxx.yyyyy.com") # changed the URL to protect my customer’s site…
self.open_if_not_url("https://xxxxxx.yyyyy.com/SiteLogin?startURL=/")
self.type("input#sitelogin:loginForm:username", "TESTUSERNAME")
self.type("input#sitelogin:loginForm:password", "testpw")
self.click("button#login")
self.open_if_not_url("https://xxxxxx.yyyyy.com/SiteLogin?sfdcIFrameOrigin=null")
.. what to do next..?
Muchas gracias!
From: Michael Mintz ***@***.***>
Reply to: seleniumbase/SeleniumBase ***@***.***>
Date: Tuesday, 12 September 2023 at 2:17 PM
To: seleniumbase/SeleniumBase ***@***.***>
Cc: ***@***.***" ***@***.***>, Author ***@***.***>
Subject: Re: [seleniumbase/SeleniumBase] How to apply js_click when elements are hidden (Discussion #2095)
sitelogin:loginForm:username isn't a valid CSS Selector. I'm not sure where you're getting that from.
You could try using the SeleniumBase Recorder to generate your scripts for you: https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/recorder_mode.md
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Your id contains self.js_type('input[id="sitelogin:loginForm:username"]', "TESTUSERNAME") and the next line would be: self.js_type('input[id="sitelogin:loginForm:password"]', "testpw") Let me know if that solves your issue, and I'll update the Recorder to take that into account. Also, if that page contains any |
Beta Was this translation helpful? Give feedback.
-
You beauty – it works 😊 🙏🙏🙏
(and no <iframe> elements, I had checked that prior also…)
From: Michael Mintz ***@***.***>
Reply to: seleniumbase/SeleniumBase ***@***.***>
Date: Tuesday, 12 September 2023 at 2:57 PM
To: seleniumbase/SeleniumBase ***@***.***>
Cc: ***@***.***" ***@***.***>, Author ***@***.***>
Subject: Re: [seleniumbase/SeleniumBase] How to apply js_click when elements are hidden (Discussion #2095)
Your id contains :, which has special meaning with CSS Selectors. Use a selector like this instead: input[id="sitelogin:loginForm:username"] and then the full line would be:
self.type('input[id="sitelogin:loginForm:username"]', "TESTUSERNAME")
and the next line would be:
self.type('input[id="sitelogin:loginForm:password"]', "testpw")
Let me know if that solves your issue, and I'll update the Recorder to take that into account.
Also, if that page contains any <iframe> elements, you'll need to switch into that first.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Instead of using the self.type or self.asssert_element syntax I've tried using the self.js_click syntax, given that the elements I'm looking for (username and password) are hidden, but have not had any luck..
Any suggestions - or examples of - how I should use the js_click to get this to work..?
MUCH APPRECIATED
Beta Was this translation helpful? Give feedback.
All reactions