Skip to content
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

set address visibility field per setting #79

Merged
merged 4 commits into from May 25, 2022
Merged

set address visibility field per setting #79

merged 4 commits into from May 25, 2022

Conversation

DenisLanz
Copy link
Contributor

Issue #, if available:
#74 #75
Description of changes:
added a setting for address visibility and set the checkmark accordingly to enable the street input field

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@sebthom
Copy link
Contributor

sebthom commented May 25, 2022

How about instead of adding a new configuration option use something like this?

        #############################
        # set contact street
        #############################
        if ad_cfg["contact"]["street"]:
            try:
                self.webdriver.find_element(By.ID, "addressVisibility").click()
                pause(2000)
            except NoSuchElementException:
                # ignore
                pass
            self.web_input(By.ID, "pstad-street", ad_cfg["contact"]["street"])

@DenisLanz
Copy link
Contributor Author

You mean make it implicit, if a street is configured to check the adressVisibility? Would that allow the user to configure that on a per ad basis if there is a street in the default configuration?

@sebthom
Copy link
Contributor

sebthom commented May 25, 2022

If they explicitly set the street to an empty value yes

@DenisLanz
Copy link
Contributor Author

Alright. Now I just need to figure out how I can update a pull request. 😄

@DenisLanz
Copy link
Contributor Author

Used and tested your code, worked well and I could publish an ad. Learned a lot with my first contribution to a public repository and python, thanks.

@sebthom
Copy link
Contributor

sebthom commented May 25, 2022

Can you try if it works like this too?

        if ad_cfg["contact"]["street"]:
                try:
                    if not self.webdriver.find_element(By.ID, "pstad-street").is_enabled():
                        self.webdriver.find_element(By.ID, "addressVisibility").click()
                        pause(2000)
                except NoSuchElementException:
                    # ignore
                    pass
            self.web_input(By.ID, "pstad-street", ad_cfg["contact"]["street"])

@DenisLanz
Copy link
Contributor Author

pushed before testing… 🙄 need to fix something first

@DenisLanz
Copy link
Contributor Author

Fixed and tested it. Stumbled over another unrelated issues though

Message: Element xpath='//meta[@name='_csrf']' not found

went away on the second attempt.

@sebthom
Copy link
Contributor

sebthom commented May 25, 2022

I think now I screwed up trying to resolve the merge conflict. :-/ Can you remove the last commit from your main branch?

@DenisLanz
Copy link
Contributor Author

Like so?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants