我有这个问题,因为我找不到适当的解决方案。
在网站上,我正在尝试使用代码更改个人资料图片。有“上传”按钮,可以打开selectfiledialog。
当我尝试通过document.getElementsbytagname(“输入”)找到输入标签时,它找不到上传的任何输入。 (所以我不能只做element.sendkeys()),
当我选择对话框中的文件时,它可以使用这种方式,然后网站将其转换为数据URI并将其设置为< img> src +它设置样式=变换:矩阵(values params)

所以我找到了这个解决方案,它将图像转换为数据URI并将其设置为 src 参数像网站一样。我还计算矩阵参数值。
我的问题是,当我稍后单击“保存”按钮时,由于某种原因,网站重置我的CSS样式,然后在我更改 src 的情况下将图片保存不良
(以前的Avatar中保留了Transform样式保留)
这就是我通过上传按钮上传手动时的外观,否则我可以matrix()值
但是当我单击“保存”按钮时,它会像第一张图片一样保存,就像它不会在我的矩阵中计数( )值。我可以以某种方式进入保存按钮函数并在我的matrix()编辑中强制强制吗?还是在不按按钮的情况下模拟上传功能?
时,如何处理硒中的selectfiledialog
- 或者,当没有&lt ;输入>在html代码中,
- 我不能使用system.windows.forms.sendkeys.sendwait(path);
我还尝试使用autoitx,但是我的项目中的库遇到了一些问题,如果可能的话,我想在没有库的情况下处理它。
非常感谢您的所有答案:)
**编辑
我找到了其中包含代码的.js文件,但是我不知道如何调用例如在方法图像 javaScript的代码
I have this problem for I can't find proper solution.
On website trovo.live I'm trying to change profile picture with code. There is 'Upload' button, which opens SelectFileDialog.
When I try to find input tag via document.getElementsByTagName("input") it doesn't find any input for uploading. (So I can't just do element.SendKeys() )
It works this way, when I select file in dialog then website converts it into data URI and set it as < img > src + it sets style = transform: matrix(values params)

So I found this solution that I convert image into data URI and set it as src parameter like website do it. Also I calculate matrix parameter values.
My problem is when I click save button later, website for some reason resets my css style and then picture is saved with bad positioning
After I change src by code (transform style remains from previous avatar)

This is how it looks when I upload manualy by Upload button or I can matrix() values 
But when I click save button, it saves like that first picture, like it wouldn't count in my matrix() values. Can I somehow get into save button function and force in my matrix() edit? Or simulate Upload function without pressing button?
Or how can I handle selectFileDialog in selenium when
- No < input > in HTML code
- I can't use System.Windows.Forms.SendKeys.SendWait(path);
I also tried to use AutoItX, but I had some problems with their library in my project and I would like to handle it without libraries if possible.
Thank you very much for all answers :)
**edit
I found .js file which contains code for it, but I have no idea how to call for example method for resizing on method image code for javascript
发布评论