faustf Posted September 11, 2020 Share Posted September 11, 2020 hi guys how is possible click over a popup like in this photo ? https://ibb.co/wNZBzwG thankz Link to comment Share on other sites More sharing options...
Danp2 Posted September 11, 2020 Share Posted September 11, 2020 Yes Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
faustf Posted September 11, 2020 Author Share Posted September 11, 2020 i try to do that with this part of code but not click over how is possible click over popup ? expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.14.5 Author: faustf Script Function: lillirobot #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here ; Script Start - Add your code below here #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <IE.au3> #include <Array.au3> #include "wd_core.au3" #include "wd_helper.au3" #include <GuiComboBoxEx.au3> Global $sDesiredCapabilities,$sSession Global $sGMail='xxxxxxxxxxxxx' Global $sGPass='xxxxxx' SetupGecko() _WD_Startup() If @error <> $_WD_ERROR_Success Then Exit -1 EndIf $sSession = _WD_CreateSession($sDesiredCapabilities) _WD_Navigate($sSession, "https://www.instagram.com/?hl=it") _WD_Timeouts($sSession, '{"pageLoad":3000}') Sleep (2000) ;<input size="45" name="all" type="TEXT"> $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@name='username']") If @error = $_WD_ERROR_Success Then _WD_ElementAction($sSession, $sElement, 'click') _WD_ElementAction($sSession, $sElement, 'value', $sGMail) EndIf $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@name='password']") If @error = $_WD_ERROR_Success Then _WD_ElementAction($sSession, $sElement, 'click') _WD_ElementAction($sSession, $sElement, 'value', $sGPass) EndIf $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//button[@type='submit']") If @error = $_WD_ERROR_Success Then _WD_ElementAction($sSession, $sElement, 'click') EndIf _WD_LoadWait($sSession) While 1 Local $sLHtmlSource=_WD_GetSource($sSession) if StringInStr ($sLHtmlSource,"Vuoi salvare le informazioni di accesso?") Then ExitLoop EndIf WEnd Local $sLHtmlSource=_WD_GetSource($sSession) ConsoleWrite($sLHtmlSource&@CRLF) $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//button[@type='button']") If @error = $_WD_ERROR_Success Then _WD_ElementAction($sSession, $sElement, 'click') EndIf MsgBox(0,'','sono qui') $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//button[@tabindex='0']") If @error = $_WD_ERROR_Success Then _WD_ElementAction($sSession, $sElement, 'click') EndIf ;_WD_DeleteSession($sSession) ;_WD_Shutdown() Func SetupGecko() _WD_Option('Driver', 'geckodriver.exe') _WD_Option('DriverParams', '--log trace') _WD_Option('Port', 4444) $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"browserName": "firefox", "acceptInsecureCerts":true}}}' EndFunc Link to comment Share on other sites More sharing options...
Danp2 Posted September 11, 2020 Share Posted September 11, 2020 Some general feedback on your script -- _WD_Timeouts($sSession, '{"pageLoad":3000}') Not sure why you need this, but should likely be placed before the navigation to have the effect you desire. Sleep (2000) Shouldn't be needed. Use this instead -- _WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@name='username']") _WD_ElementAction($sSession, $sElement, 'click') Don't see why these would be necessary. Did you try without the click? While... WEnd Drop this whole thing and just use a single call to _WD_WaitElement looking for the desired xpath. If found, then use _WD_FindElement and _WD_ElementAction to locate and click the element Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
faustf Posted September 12, 2020 Author Share Posted September 12, 2020 i try to add your fixed but not work ,without sleep run fast without click not insert in inputbox a mail and pass Link to comment Share on other sites More sharing options...
Musashi Posted September 12, 2020 Share Posted September 12, 2020 2 hours ago, faustf said: i try to add your fixed but not work ,without sleep run fast without click not insert in inputbox a mail and pass (OT : just a friendly suggestion) I really do not want to be intimidating, but PLEASE try https://www.deepl.com/translate . The automatic translation should be a lot easier to understand compared to your Yoda-Speak . "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." Link to comment Share on other sites More sharing options...
Danp2 Posted September 12, 2020 Share Posted September 12, 2020 @faustf You've been around here long enough to know better then to tell us something like "doesn't work" without providing further details. I've tried these suggestions with your original code and they worked for me. However, I'm not going to spoon feed you the solution. So show us the revised code and also the Scite console output so that we can see where you went wrong. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Purity8 Posted September 12, 2020 Share Posted September 12, 2020 (edited) Func SetupGecko() _WD_Option('Driver', '../Required/geckodriver.exe') _WD_Option('DriverParams', '--marionette-port 2828') _WD_Option('Port', 4444) $sDesiredCapabilities = '{"capabilities":{"alwaysMatch": {"moz:firefoxOptions": {"args": ["-profile", "C:/Users/Admin/AppData/Roaming/Mozilla/Firefox/Profiles/(whatever)"],"log": {"level": "trace"}}}}}' EndFunc This info was taken from the Wiki FAQ's page, which is suppose to utilize an existing user profile. It works fine for users with one firefox profile, but what about those with multiple profiles? I have 2 different sessions in use - A and B. If I close / Alt+F4 session A and then B, the next time I run the wd_demo.au3 DemoNav, session B will open up. And vice versa; if I close / Alt+F4 session B and then A, the next time I run the wd_demo.au3 DemoNav, session A will open up. Is there a way to make it stick with one profile specifically for users that have more than 2 profiles? Edited September 12, 2020 by Purity8 Link to comment Share on other sites More sharing options...
Danp2 Posted September 12, 2020 Share Posted September 12, 2020 @Purity8 Sorry, but I don't understand your explanation of the problem. If you are supplying a profile in the Capacities string, then I don't understand how the wrong profile could be loading. Is this all occurring in instances launched via geckodriver or are you manually launching firefox in some instance. Please clarify exactly what steps you are performing. P.S. It's kind of odd that you "hijacked" this thread, which is on a completely unrelated issue, instead of starting your own. 🙄 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Purity8 Posted September 12, 2020 Share Posted September 12, 2020 3 minutes ago, Danp2 said: P.S. It's kind of odd that you "hijacked" this thread, which is on a completely unrelated issue, instead of starting your own. 🙄 My apologies, I have a habit of reading the forums & forget to check where I'm browsing. Or maybe its that I'm seeing the user @faustf post in almost everywhere & I'm getting lost somehow... I thought I was already in:WebDriver UDF (W3C compliant version) - 08/28/2020 - page 39 I'll move (back) over there for more assistance. Link to comment Share on other sites More sharing options...
faustf Posted September 14, 2020 Author Share Posted September 14, 2020 hi i dont want a spoon feed , i ask only how is possible click over popup this is a code with correction and this is a how work expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.14.5 Author: faustf Script Function: lillirobot #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here ; Script Start - Add your code below here #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <IE.au3> #include <Array.au3> #include "wd_core.au3" #include "wd_helper.au3" #include <GuiComboBoxEx.au3> Global $sDesiredCapabilities,$sSession Global $sGMail='xxxxxxxxxxxx' Global $sGPass='xxxxxxxxxxxxxx' SetupGecko() _WD_Startup() If @error <> $_WD_ERROR_Success Then Exit -1 EndIf $sSession = _WD_CreateSession($sDesiredCapabilities) _WD_Timeouts($sSession, '{"pageLoad":3000}') _WD_Navigate($sSession, "https://www.instagram.com/?hl=it") ;Sleep (2000) ;<input size="45" name="all" type="TEXT"> $sElement = _WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@name='username']") If @error = $_WD_ERROR_Success Then ;_WD_ElementAction($sSession, $sElement, 'click') _WD_ElementAction($sSession, $sElement, 'value', $sGMail) EndIf $sElement = _WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@name='password']") If @error = $_WD_ERROR_Success Then ;_WD_ElementAction($sSession, $sElement, 'click') _WD_ElementAction($sSession, $sElement, 'value', $sGPass) EndIf $sElement = _WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, "//button[@type='submit']") If @error = $_WD_ERROR_Success Then _WD_ElementAction($sSession, $sElement, 'click') EndIf _WD_LoadWait($sSession) #cs While 1 Local $sLHtmlSource=_WD_GetSource($sSession) if StringInStr ($sLHtmlSource,"Vuoi salvare le informazioni di accesso?") Then ExitLoop EndIf WEnd #ce Local $sLHtmlSource=_WD_GetSource($sSession) ;ConsoleWrite($sLHtmlSource&@CRLF) $sElement = _WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, "//button[@type='button']") If @error = $_WD_ERROR_Success Then _WD_ElementAction($sSession, $sElement, 'click') EndIf MsgBox(0,'','sono qui') $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//button[@tabindex='0']") If @error = $_WD_ERROR_Success Then _WD_ElementAction($sSession, $sElement, 'click') EndIf ;_WD_DeleteSession($sSession) ;_WD_Shutdown() Func SetupGecko() _WD_Option('Driver', 'geckodriver.exe') _WD_Option('DriverParams', '--log trace') _WD_Option('Port', 4444) $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"browserName": "firefox", "acceptInsecureCerts":true}}}' EndFunc thankz at all Link to comment Share on other sites More sharing options...
Danp2 Posted September 14, 2020 Share Posted September 14, 2020 You are using _WD_WaitElement incorrectly (hint: it doesn't return the found element). Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now