SeleniumHQ / selenium-ide

Open Source record and playback test automation for the web.
https://selenium.dev/selenium-ide/
Apache License 2.0
2.77k stars 750 forks source link

export python assert ${val} become a string #1244

Open FuckyouBB opened 3 years ago

FuckyouBB commented 3 years ago

when i use ide , assert text equal ${val} like this image it work ,but when i export python code,this code become

assert self.driver.find_element(By.CSS_SELECTOR, ".h-table-body-column-left:nth-child(2) span").text == "self.vars[\"bs\"]"

it doesnt work become it become string,i should manual elimenate the double quote

its a bug

Environment

OS: Selenium IDE Version: 3.17 Selenium SIDE Runner Version: Node version: Browser:Chrome Browser Version:

toddtarsi commented 3 years ago

@FuckyouBB - It sounds like you have it quite well figured out. Would you be able to clone this repo, switch to the v3 branch and test a fix?

I think the line you want to edit is here: https://github.com/SeleniumHQ/selenium-ide/blob/v3/packages/code-export-python-pytest/src/command.js#L187

Please let me know if I can help any more.

Lava-Iris commented 1 month ago

Hi! I'm encountering the same issue in a number of places...if no one is working on it, can I pick it up? It's kinda breaking my workflow.

toddtarsi commented 1 month ago

@Lava-Iris - Absolutely, but I will warn you that v3 is pretty close to like fully being shuttered. It uses webextension manifest v2, which is on super borrowed time. You might want to look into saving your stuff as a side file, and doing this move:

https://github.com/SeleniumHQ/selenium-ide/issues/1839#issuecomment-2166053016

That way there aren't concerns of putting out a new v3 version, which involves deploying to the extension stores and is harder to test too.

The python package is here:

https://github.com/SeleniumHQ/selenium-ide/tree/trunk/packages/code-export-python-pytest

Also, I actually wrap it as an example project here, in case you want to see how you could modify the export language easily:

https://github.com/SeleniumHQ/selenium-ide/blob/bc18c88153d2245ae8b35e98487a0da51460ae46/packages/side-example-suite/src/formats/custom-python.ts

toddtarsi commented 1 month ago

Lemme know how I can help. I have been taking a hiatus here for my health, as you can probably tell from the issue's list, but people willing to put in work to fix things will always have my full support.

Lava-Iris commented 1 month ago

@toddtarsi

Got it. Thanks for your support! I'm actually new to this field so I'll probably be super slow to work this out (also coz I'm kinda packed rn), but I'll try to be as quick as possible about it. The npm tool is super cool and I personally will be using it, but the problem is I'm trying to make something people without much coding knowledge can use (and the ide is perfect for it) and my target users don't have the permission or the knowledge to use npm...

Just to confirm, this is the code behind the selenium browser extension right? (Sorry if it's a stupid question)

toddtarsi commented 1 month ago

@Lava-Iris - Nope! This is the code behind v4. If you go to the branch called 'v3', that's the webextension.

Also, for authorship, you can download v4 binaries directly here without using npm.

https://github.com/SeleniumHQ/selenium-ide/releases/tag/v4.0.1-beta.12

The npm stuff is meant to play very nicely with a CI system, and also is meant to be an easy way to share and publish plugins for the IDE, but absolute and relative paths work for plugins as well so you can go without the package managers.