1

I would like to make code that embeds pdf files in a table on a viewed page in chrome. Ideally via Selenium Webdriver. Meaning I need to change html code on page from

<td align="center">&nbsp;</td>

to

<embed src="http://qwer.com/a.pdf" type = "application/pdf">

Now I have understood that you can launch JavaScript through driver.execute_script, but having no prior experience with JavaScript, I am stuck.

This is as far as I have gotten:

driver.execute_script("""document.evaluate('/html/body/div[9]/form/table/tbody/tr[10]/td[3]', document, null, XPathResult.ANY_TYPE, null).align="right";""")

This script has tried to select a cell in a html table via XPath and do a minor change - align. It failed.

I have been trying more dramatic things as well, but over time as I couldnt figure out even this simple one, I am pleading for help.

Thanks to any one with constructive criticism!

1

0

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.