-
-
Notifications
You must be signed in to change notification settings - Fork 23
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
Using frames messes up the blur effect. #50
Comments
@bioneyez Could you provide some more information for better understanding like a screenshot of the webpage with the element that you were trying to blur and the actual blur? |
On the left side you can see a house icon (thats the menu but now its collapsed). I wanted to blur out the application number text input. As you can see the blur is misaligned. I tried it without collapsing the menu and in that case the blur is even more misaligned since then the menu frame takes more space from the page. @jesse019
I think calculating the offset and adding it to the coordinates before blurring will resolve the issue. |
@bioneyez Thanks for posting a probable solution. Based on your investigation if I may ask, could you try modifying the source code to fetch coordinates using selenium driver? Currently the coordinates are fetched using javascript. Method I would need a couples of days to look into this issue and get back to you. However feel free to investigate further and raise pull request if you figure out a proper solution |
@jz-jess I tried modifying the source code as you suggested, but the result is the same. Selenium driver returns the coordinates relative to the current frame, not the whole page. https://sqa.stackexchange.com/questions/32617/how-to-get-coordinates-of-element-inside-iframe |
@bioneyez Understood. I'd prefer that we fix the issue using python similar to the code in the link above. |
@jz-jess I'm not sure we need to pass the frames as a list, since we can retrieve all the parent frames automatically. I would prefer python as well, but I think it's a struggle to get all the frame positions using selenium driver. Right now my only idea is to iterate through all the parent frames using switchTo and accumulate the offset, but then we need to switch back to the original frame. If you have a better idea please tell me. It's not urgent since I solved it locally using JS, and it works for now. If I have the time I'll try to solve it in Python as well and make a pull a request. |
@bioneyez If you have implemented the JS code in the library and called it using selenium execute script, then I would like to take a look at it. You can raise a pull request |
@jz-jess Another issue came into my mind. What if we want to blur elements in different frames. Right now I think it's only possible to blur elements in the active frame. |
@bioneyez What if we call |
@jz-jess My problem with the above mentioned suggestion is that I think it should be possible to capture the full screen and just pass a list of elements that should be blurred regardless of which frame contains which element. For example by specifying some kind of pattern ex. "frameName:class=tail". I think its cumbersome to specify a list of elements for each frame the page contains and then capturing them individually. Let me know what you think about this. |
@bioneyez Let me try to put it another way. However like you suggested when you would want to blur elements in the whole page, you would want the capture screen keyword itself to take care of all the frames present in the page and calculate offsets accordingly. This would require proper testing to ensure all cases are covered |
Thats exactly how I imagined it. |
@bioneyez So we're on the same page then :) |
@jz-jess Can you help me out implementing the capture full screen functionality the way we agreed upon earlier? I tried it and its not that straightforward as I thought. My concept was:
Unfortunately it's not working, I get StaleElementReferenceException Concerns
|
@bioneyez StaleElementReferenceException commonly occurs when iterating over a list of loctors. In this case maybe frames. I think the state of DOM is changing in between the iterations which is why the error is thrown. Before we get into the issue, in your current approach how do we get to know that the region we're trying to blur is within a particular frame? |
@jz-jess Right now I don't care about that. I'm trying to blur all the specified elements in all the frames. (later I plan to modify that but for now I think it's okay). |
@bioneyez Looks like we are trying to find a non existent element within a frame. Would this be the reason? |
I think we need to switch to default_content within the loop after blurring, so we can switch to the next frame. |
Good point. Now it looks like its working as expected. +1 TODO: make it work for iframes as well |
I think we could try blurring an element in every frame. We should catch NoSuchElement exception and continue incase element isn't present. |
I pushed the solution to the existing pull request, |
@bioneyez This has been released in v1.3.2. There were a couple of bugs in your pull request. However they were minor and I was able to fix them. I was able to test it against demo pages with iframes. |
Bug
When I try to blur an element out and the page contains frame elements then the blur is mislocated on the screenshot. For example If i have a 100px frame on the left side (menu) then on the main frame the blur effect is 100px to the left compared to the element I want to blur out.
To Reproduce
Steps to reproduce the behavior:
Try to blur out elements on a page containing frames and framesets.
Expected behavior
I expect that the specified element is blurred precisely.
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: