0

I have source code of page like this:

<header style="position: fixed;">

When I use my script on java, I can't execute click action, because my element locate under the header. And I have an error:

Element is not clickable at point (482, 10.116668701171875). Other element would receive the click...

I need to change source code of page to the next view:

<header style="position: absolute;">
4
  • Consider, please, this is bad practice for testing. You have to test product as it is Commented Mar 29, 2016 at 14:00
  • Yes, I know. I don't test the product. I do program for myself. Commented Mar 29, 2016 at 14:20
  • You can't change the source code of a page after the fact. It doesn't work that way. Commented Mar 30, 2016 at 5:44
  • I did it, like answer @Florent B. bellow Commented Mar 30, 2016 at 10:38

1 Answer 1

1

To set the style attribute on the first header tag:

((JavascriptExecutor)driver).executeScript(
    "document.getElementsByTagName('header')[0].style='position: absolute;'");

But a better solution would be to scroll the element at the top or bottom:

((JavascriptExecutor)driver).executeScript(
    "arguments[0].scrollIntoView(true);", element);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.