-
Notifications
You must be signed in to change notification settings - Fork 585
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to upload files on a web page (potential change in DevTools protocol) #376
Comments
i already tried with this one Vision code for writing on the input box of "File Name", but only write C and not continue with the ":\xxxx"
there is a way to write a path?? update: i figure out, its because my keyboard is in spanish, but for some reason stop at the end of the path and no continue i dont know why |
Hello i ready find the solution, with the inspect mode i found the xpath of the input file right next one of the element of the "browse" button so you need to put it like CSS selector like #element
|
Thanks @fez226 for raising and sharing your solution! Yes your last comment on The upload step is restricted to CSS selector for consistency reasons as the default PhantomJS mode for upload does not support XPath. Reopening this issue for the time being, to evaluate whether it makes sense to enable XPath for Chrome or Chrome headless mode. |
@kensoh Im confused, the upload step doesnt work on chrome headless mode? because i need it to work.. but i havent try it yet. I tried on Chrome and works fine, but i need it on headless mode |
It should work for headless similar to visible Chrome. But for CSS selectors only. Am considering breaking the consistency with PhantomJS and enable XPaths to also work. |
Hello @kensoh the step upload works but when i try to sorry the web page its not public, if i stop the cmd and click it manually it works so i dont understand update: actually no next step works after the upload step, i tried to check the radio button on top and doesn't work either
the first click CFRProcess_Expired works fine... but the second one with value Yes doesnt work |
For your 1st post above, do you mean after using upload step other steps cannot work? It might be the website needs user to actually upload and trigger some JS code before continuing. But will be hard to troubleshoot as the webpage is publicly accessible. For your 2nd post above, for Windows, set display magnification to recommended %, if it does not work then 100%. The magnification factor can affect how Sikuli sees the screen. Also, you can try using visual automation on other UI elements to see if visual automation works ok on your laptop. In headless mode, Sikuli will not be able to interact because it needs a screen to perform visual automation. So it only works with a real screen, or virtual servers, or Linux with XVBF (which I heard is hard to setup). |
Looked through enabling XPath for Chrome upload step. It would require
Users can use visual automation method to upload files or use the |
Dear @kensoh thank u for your replay i will see it with my partner to understand the 1st replay, yes after using upload step other steps doesnt work. and thank u for the second reply, with CSS Selector works fine so its doesnt matter xPath so the final answer is: upload the files with Sikuli on foreground chrome? another questio, i really dont understand this part:
|
@kensoh maybe with this one solution? |
Yes that's right, it looks like for your use case and website the best approach is using Sikuli on foreground Chrome. Oh for that part I was suggesting to test visual automation on some simple test case to verify that Sikuli works on your laptop. The PhantomJS one is for default PhantomJS mode, for Chrome I wrote the commands to control Chrome to upload. I'll check more on this, I suspect it could be something changed on Chrome DevTools protocol which cause steps after |
Thank u @kensoh, i will appreciate if you can help me with the Chrome DevTools Protocol, if the next steps after the i try it some days ago and Sikuli does works on my laptop, but i think in this solution but doesnt work on headless mode: do the |
There is likely a change in Chrome Devtools protocol which returns back DOM.attributeModified event messages after DOM.setFileInputFiles method is used in update step. This causes subsequent steps after upload step not to work. This patch works by filtering and discarding the DOM.attributeModified event messages so that subsequent communication messages with Chrome will continue to work.
There is likely a change in Chrome Devtools protocol which returns back DOM.attributeModified event messages after DOM.setFileInputFiles method is used in update step. This causes subsequent steps after upload step not to work. This patch works by filtering and discarding the DOM.attributeModified event messages so that subsequent communication messages with Chrome will continue to work.
Made a PR and committed to master with following comment. It should work now, thanks @fez226 !
Prior to packaged release, the patch is available from cutting edge version here - |
thank u @kensoh i will try it, i never replace the existing files, i dont have the master.zip i download the second option below now i have to download the master.zip and replace my files with this one new? |
hello @kensoh i tried on another web page (link below) and the steps after the
|
There is likely a change in Chrome Devtools protocol which returns back DOM.attributeModified event messages after DOM.setFileInputFiles method is used in update step. This causes subsequent steps after upload step not to work. Patch 1 works by filtering and discarding the DOM.attributeModified event messages so that subsequent communication messages with Chrome will continue to work. Patch 2 works by filtering and discarding DOM. events completely. And also send a DOM.disable call to disable further sending of DOM. event messages.
There is likely a change in Chrome Devtools protocol which returns back DOM.attributeModified event messages after DOM.setFileInputFiles method is used in update step. This causes subsequent steps after upload step not to work. Patch 1 works by filtering and discarding the DOM.attributeModified event messages so that subsequent communication messages with Chrome will continue to work. Patch 2 works by filtering and discarding DOM. events completely. And also send a DOM.disable call to disable further sending of DOM. event messages.
Got it @fez226 thanks for sharing this additional test case. I was testing with below and it works.
Made another PR and committed to master with following comment -
Technical notes for future reference -
Prior to packaged release, the patch is available from cutting edge version here - |
Hello @kensoh i download the TaguiMaster.zip and replace this 3 files and i tried again with my original web page and finally works!! i thank u some much for the help, officially the issue is closed |
No probs @fez226 , appreciate that you raise this! Root cause is potentially due to a change in Chrome DevTools. This is not a common use case and it can be left un-noticed if you do not feedback. |
Adding some technical notes for future reference. Was trying to see if XPath can be enabled for upload step for Chrome instead of just CSS selector. According to the DevTools protocol documentation for DOM domain, the following series of DevTools protocol exchange would yield a nodeId through XPath search which could be used to set the filename on the upload web element.
However, it was found that the nodeId 0 is returned and that leads to an error not found when trying to interact with the upload element. It could be the DOM.performSearch method is still experimental (as labelled in above documentation). In any case, that does not seem technically possible now, attached communication logs (done in TagUI live mode) for future reference. DOM.enable is required otherwise Chrome will return a 'DOM agent is not enabled' message when DOM.performSearch is called.
|
Hello @kensoh i hope you are fine.
i have a doubt with the:
upload element (CSS selector only) as filename to upload
you have an example of how to used?
i have a webpage and i need to upload some files: i click on the Browse Button and the windows open pop up, see the image below... i have the route and file name
The text was updated successfully, but these errors were encountered: